ntdll-Junction_Points: Updates from Erich E. Hoover.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49790
This commit is contained in:
Zebediah Figura 2020-09-27 20:30:44 -05:00
parent 0a299f39c8
commit 7bd8acb4ca

View File

@ -1,20 +1,20 @@
From 398754456f977e063aa1c180301ce44fd5fdaf84 Mon Sep 17 00:00:00 2001
From 46d3165f1d7103851a5c15ed69d94be897186093 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: Add support for deleting junction points with
Subject: [PATCH] server: Add support for deleting junction points with
RemoveDirectory.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
---
dlls/ntdll/tests/file.c | 34 +++++++++++++++++++++++++++++++++-
server/fd.c | 27 ++++++++++++++++++---------
2 files changed, 51 insertions(+), 10 deletions(-)
server/fd.c | 37 ++++++++++++++++++++++++++++---------
2 files changed, 61 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 051237dd494..77a1be8307b 100644
index 96fbe4501bc..2ac30551cf6 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -5010,7 +5010,7 @@ static void test_reparse_points(void)
@@ -5240,7 +5240,7 @@ static void test_reparse_points(void)
REPARSE_GUID_DATA_BUFFER guid_buffer;
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
@ -23,7 +23,7 @@ index 051237dd494..77a1be8307b 100644
INT buffer_len, string_len;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -5099,6 +5099,38 @@ static void test_reparse_points(void)
@@ -5329,6 +5329,38 @@ static void test_reparse_points(void)
"Junction point folder's access time does not match.\n");
CloseHandle(handle);
@ -63,7 +63,7 @@ index 051237dd494..77a1be8307b 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/server/fd.c b/server/fd.c
index 7ea8ac273e5..c0d35e2fa4c 100644
index bca4f20d8ef..08d080ecd32 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -169,7 +169,8 @@ struct closed_fd
@ -109,7 +109,52 @@ index 7ea8ac273e5..c0d35e2fa4c 100644
free( fd->unix_name );
free( fd );
}
@@ -1903,18 +1907,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1572,6 +1576,7 @@ static void fd_destroy( struct object *obj )
else /* no inode, close it right away */
{
if (fd->unix_fd != -1) close( fd->unix_fd );
+ free( fd->unlink_name );
free( fd->unix_name );
}
}
@@ -1681,6 +1686,7 @@ static struct fd *alloc_fd_object(void)
fd->options = 0;
fd->sharing = 0;
fd->unix_fd = -1;
+ fd->unlink_name = NULL;
fd->unix_name = NULL;
fd->cacheable = 0;
fd->signaled = 1;
@@ -1716,6 +1722,7 @@ struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *use
fd->access = 0;
fd->options = options;
fd->sharing = 0;
+ fd->unlink_name = NULL;
fd->unix_name = NULL;
fd->unix_fd = -1;
fd->cacheable = 0;
@@ -1750,6 +1757,12 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
strcpy( fd->unix_name, orig->unix_name );
}
+ if (orig->unlink_name)
+ {
+ if (!(fd->unlink_name = mem_alloc( strlen(orig->unlink_name) + 1 ))) goto failed;
+ strcpy( fd->unlink_name, orig->unlink_name );
+ }
+
if (orig->inode)
{
struct closed_fd *closed = mem_alloc( sizeof(*closed) );
@@ -1762,6 +1775,7 @@ struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sha
}
closed->unix_fd = fd->unix_fd;
closed->unlink = 0;
+ closed->unlink_name = fd->unlink_name;
closed->unix_name = fd->unix_name;
fd->closed = closed;
fd->inode = (struct inode *)grab_object( orig->inode );
@@ -1903,18 +1917,19 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
fd->unix_name = NULL;
if ((path = dup_fd_name( root, name )))
{
@ -132,7 +177,7 @@ index 7ea8ac273e5..c0d35e2fa4c 100644
{
unsigned int err;
struct inode *inode = get_inode( st.st_dev, st.st_ino, fd->unix_fd );
@@ -1932,6 +1937,9 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
@@ -1932,6 +1947,9 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
list_add_head( &inode->open, &fd->inode_entry );
closed_fd = NULL;
@ -142,7 +187,7 @@ index 7ea8ac273e5..c0d35e2fa4c 100644
/* check directory options */
if ((options & FILE_DIRECTORY_FILE) && !S_ISDIR(st.st_mode))
{
@@ -2563,10 +2571,11 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr,
@@ -2569,10 +2587,11 @@ static void set_fd_name( struct fd *fd, struct fd *root, const char *nameptr,
fchmod( fd->unix_fd, st.st_mode );
}