Rebase against 00e55c8fc0c08e14c39880e62526f8503468b641

This commit is contained in:
Alistair Leslie-Hughes
2020-03-24 08:55:13 +11:00
parent 7c7868f4bb
commit 75c7644c3d
10 changed files with 85 additions and 159 deletions

View File

@@ -1,66 +0,0 @@
From d3eff4b920f4bc700046779cc44cea186b4cf28a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 3 Jun 2015 01:37:34 +0200
Subject: server: When combining root and name, make sure there is only one
slash. (v2)
Changes in v2:
* Resolve inter-patch conflict.
---
dlls/ntdll/tests/file.c | 4 ++--
server/fd.c | 16 ++++++++++++----
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index a24ce35..8b20966 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2147,8 +2147,8 @@ static void test_file_rename_information(void)
res = pNtQueryInformationFile( handle, &io, fni, sizeof(FILE_NAME_INFORMATION) + MAX_PATH * sizeof(WCHAR), FileNameInformation );
ok( res == STATUS_SUCCESS, "res expected STATUS_SUCCESS, got %x\n", res );
fni->FileName[ fni->FileNameLength / sizeof(WCHAR) ] = 0;
- todo_wine ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n",
- wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) );
+ ok( !lstrcmpiW(fni->FileName, newpath + 2), "FileName expected %s, got %s\n",
+ wine_dbgstr_w(newpath + 2), wine_dbgstr_w(fni->FileName) );
HeapFree( GetProcessHeap(), 0, fni );
CloseHandle( handle );
diff --git a/server/fd.c b/server/fd.c
index ea328d2..e6bd5e0 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -1730,6 +1730,7 @@ void set_fd_user( struct fd *fd, const struct fd_ops *user_ops, struct object *u
char *dup_fd_name( struct fd *root, const char *name )
{
char *ret;
+ int len;
if (!root) return strdup( name );
if (!root->unix_name) return NULL;
@@ -1737,11 +1738,18 @@ char *dup_fd_name( struct fd *root, const char *name )
/* skip . prefix */
if (name[0] == '.' && (!name[1] || name[1] == '/')) name++;
- if ((ret = malloc( strlen(root->unix_name) + strlen(name) + 2 )))
+ len = strlen( root->unix_name );
+ if ((ret = malloc( len + strlen(name) + 2 )))
{
- strcpy( ret, root->unix_name );
- if (name[0] && name[0] != '/') strcat( ret, "/" );
- strcat( ret, name );
+ memcpy( ret, root->unix_name, len );
+ while (len && ret[len - 1] == '/') len--;
+ while (name[0] == '/') name++;
+ if (name[0])
+ {
+ ret[ len ] = '/';
+ strcpy( ret + len + 1, name );
+ }
+ else ret[ len ] = 0;
}
return ret;
}
--
2.9.0