ntdll-Junction_Points: Fix build on FreeBSD 12

This commit is contained in:
Gerald Pfeifer 2023-02-13 08:21:31 +11:00 committed by Alistair Leslie-Hughes
parent b75b4fc0fa
commit 3367490837

View File

@ -1,16 +1,16 @@
From da698613af1808ca0fe2599bc4b7898fad9dcf18 Mon Sep 17 00:00:00 2001
From 1656f670f68ce218458fc26dc8688c78d99091cb Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:02:11 -0700
Subject: server: Implement FILE_OPEN_REPARSE_POINT option.
Subject: [PATCH] server: Implement FILE_OPEN_REPARSE_POINT option.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/kernelbase/file.c | 2 +
server/fd.c | 142 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 137 insertions(+), 7 deletions(-)
server/fd.c | 144 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 139 insertions(+), 7 deletions(-)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 5ba7e0be419..bfb291fa925 100644
index ac04388acde..d0da370ae88 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -735,6 +735,8 @@ static UINT get_nt_file_options( DWORD attributes )
@ -23,7 +23,7 @@ index 5ba7e0be419..bfb291fa925 100644
}
diff --git a/server/fd.c b/server/fd.c
index eaebe044f37..1ed975673a6 100644
index eaebe044f37..db645779dc6 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -31,6 +31,7 @@
@ -136,7 +136,7 @@ index eaebe044f37..1ed975673a6 100644
}
}
free( fd->unix_name );
@@ -1888,6 +1965,36 @@ void get_nt_name( struct fd *fd, struct unicode_str *name )
@@ -1888,6 +1965,38 @@ void get_nt_name( struct fd *fd, struct unicode_str *name )
name->len = fd->nt_namelen;
}
@ -155,8 +155,10 @@ index eaebe044f37..1ed975673a6 100644
+{
+ char tmp[PATH_MAX], resolved_path[PATH_MAX], *p;
+
+#if defined(O_SYMLINK)
+ if ((flags & O_SYMLINK) != O_SYMLINK)
+ return realpath( path, NULL );
+#endif
+
+ strcpy( tmp, path );
+ p = dirname( tmp );
@ -173,7 +175,7 @@ index eaebe044f37..1ed975673a6 100644
/* open() wrapper that returns a struct fd with no fd user set */
struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_name,
int flags, mode_t *mode, unsigned int access,
@@ -1948,6 +2055,15 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
@@ -1948,6 +2057,15 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
}
else rw_mode = O_RDONLY;
@ -189,7 +191,7 @@ index eaebe044f37..1ed975673a6 100644
if ((fd->unix_fd = open( name, rw_mode | (flags & ~O_TRUNC), *mode )) == -1)
{
/* if we tried to open a directory for write access, retry read-only */
@@ -1972,7 +2088,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
@@ -1972,7 +2090,7 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
fd->unix_name = NULL;
if ((path = dup_fd_name( root, name )))
{
@ -198,7 +200,7 @@ index eaebe044f37..1ed975673a6 100644
free( path );
}
@@ -1983,10 +2099,11 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
@@ -1983,10 +2101,11 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
*mode = st.st_mode;
/* only bother with an inode for normal files and directories */
@ -211,7 +213,7 @@ index eaebe044f37..1ed975673a6 100644
if (!inode)
{
@@ -2001,13 +2118,17 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
@@ -2001,13 +2120,17 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
list_add_head( &inode->open, &fd->inode_entry );
closed_fd = NULL;
@ -231,7 +233,7 @@ index eaebe044f37..1ed975673a6 100644
{
set_error( STATUS_FILE_IS_A_DIRECTORY );
goto error;
@@ -2439,6 +2560,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
@@ -2439,6 +2562,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl
static int is_dir_empty( int fd )
{
@ -239,7 +241,7 @@ index eaebe044f37..1ed975673a6 100644
DIR *dir;
int empty;
struct dirent *de;
@@ -2446,8 +2568,13 @@ static int is_dir_empty( int fd )
@@ -2446,8 +2570,13 @@ static int is_dir_empty( int fd )
if ((fd = dup( fd )) == -1)
return -1;
@ -254,7 +256,7 @@ index eaebe044f37..1ed975673a6 100644
close( fd );
return -1;
}
@@ -2459,6 +2586,7 @@ static int is_dir_empty( int fd )
@@ -2459,6 +2588,7 @@ static int is_dir_empty( int fd )
empty = 0;
}
closedir( dir );
@ -262,7 +264,7 @@ index eaebe044f37..1ed975673a6 100644
return empty;
}
@@ -2497,7 +2625,7 @@ static void set_fd_disposition( struct fd *fd, int unlink )
@@ -2497,7 +2627,7 @@ static void set_fd_disposition( struct fd *fd, int unlink )
file_set_error();
return;
}
@ -272,5 +274,5 @@ index eaebe044f37..1ed975673a6 100644
if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)))
{
--
2.17.1
2.39.1