server-unix_name: New patch set.

This commit is contained in:
Zebediah Figura 2020-12-02 10:34:59 -06:00
parent f9e86098b3
commit 968e22f2ed
3 changed files with 119 additions and 0 deletions

View File

@ -215,6 +215,7 @@ patch_enable_all ()
enable_server_Registry_Notifications="$1"
enable_server_Signal_Thread="$1"
enable_server_Stored_ACLs="$1"
enable_server_unix_name="$1"
enable_setupapi_DiskSpaceList="$1"
enable_setupapi_SPFILENOTIFY_FILEINCABINET="$1"
enable_shdocvw_ParseURLFromOutsideSource_Tests="$1"
@ -726,6 +727,9 @@ patch_enable ()
server-Stored_ACLs)
enable_server_Stored_ACLs="$2"
;;
server-unix_name)
enable_server_unix_name="$2"
;;
setupapi-DiskSpaceList)
enable_setupapi_DiskSpaceList="$2"
;;
@ -3591,6 +3595,18 @@ if test "$enable_server_Registry_Notifications" -eq 1; then
patch_apply server-Registry_Notifications/0002-server-Introduce-refcounting-for-registry-notificati.patch
fi
# Patchset server-unix_name
# |
# | This patchset fixes the following Wine bugs:
# | * [#46070] Basemark Web 3.0 Desktop Launcher crashes
# |
# | Modified files:
# | * server/fd.c, server/file.c, server/file.h
# |
if test "$enable_server_unix_name" -eq 1; then
patch_apply server-unix_name/0001-server-Try-to-retrieve-the-unix-name-on-handles-crea.patch
fi
# Patchset setupapi-DiskSpaceList
# |
# | Modified files:

View File

@ -0,0 +1,102 @@
From e390b67fa52b0808b71bb4c7feb08ca12a3a7444 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= <gabrielopcode@gmail.com>
Date: Mon, 21 Sep 2020 17:27:00 +0300
Subject: [PATCH] server: Try to retrieve the unix name on handles created from
file descriptors.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46070
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
---
server/fd.c | 39 +++++++++++++++++++++++++++++++++++++++
server/file.c | 1 +
server/file.h | 2 ++
3 files changed, 42 insertions(+)
diff --git a/server/fd.c b/server/fd.c
index edb59b0d540..8348ed7cf97 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2012,6 +2012,45 @@ struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops, int unix_fd, s
return NULL;
}
+void set_unix_name_of_fd( struct fd *fd, const struct stat *fd_st )
+{
+#ifdef __linux__
+ static const char procfs_fmt[] = "/proc/self/fd/%d";
+
+ char path[PATH_MAX], procfs_path[sizeof(procfs_fmt) - 2 /* %d */ + 11];
+ struct stat path_st;
+ ssize_t len;
+
+ sprintf( procfs_path, procfs_fmt, fd->unix_fd );
+ len = readlink( procfs_path, path, sizeof(path) );
+ if (len == -1 || len >= sizeof(path) )
+ return;
+ path[len] = '\0';
+
+ /* Make sure it's an absolute path, has at least one hardlink, and the same inode */
+ if (path[0] != '/' || stat( path, &path_st ) || path_st.st_nlink < 1 ||
+ path_st.st_dev != fd_st->st_dev || path_st.st_ino != fd_st->st_ino)
+ return;
+
+ if (!(fd->unix_name = mem_alloc( len + 1 )))
+ return;
+ memcpy( fd->unix_name, path, len + 1 );
+
+#elif defined(F_GETPATH)
+ char path[PATH_MAX];
+ size_t size;
+
+ if (fcntl( fd->unix_fd, F_GETPATH, path ) == -1 || path[0] != '/')
+ return;
+
+ size = strlen(path) + 1;
+ if (!(fd->unix_name = mem_alloc( size )))
+ return;
+ memcpy( fd->unix_name, path, size );
+
+#endif
+}
+
/* retrieve the object that is using an fd */
void *get_fd_user( struct fd *fd )
{
diff --git a/server/file.c b/server/file.c
index 2cc4a9d978c..0bbdae41649 100644
--- a/server/file.c
+++ b/server/file.c
@@ -146,6 +146,7 @@ struct file *create_file_for_fd( int fd, unsigned int access, unsigned int shari
release_object( file );
return NULL;
}
+ set_unix_name_of_fd( file->fd, &st );
allow_fd_caching( file->fd );
return file;
}
diff --git a/server/file.h b/server/file.h
index 69f2bed6cd6..6967bda7279 100644
--- a/server/file.h
+++ b/server/file.h
@@ -22,6 +22,7 @@
#define __WINE_SERVER_FILE_H
#include <sys/types.h>
+#include <sys/stat.h>
#include "object.h"
@@ -82,6 +83,7 @@ extern struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t
unsigned int access, unsigned int sharing, unsigned int options );
extern struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops,
int unix_fd, struct object *user, unsigned int options );
+extern void set_unix_name_of_fd( struct fd *fd, const struct stat *fd_st );
extern struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sharing,
unsigned int options );
extern struct fd *get_fd_object_for_mapping( struct fd *fd, unsigned int access, unsigned int sharing );
--
2.29.2

View File

@ -0,0 +1 @@
Fixes: [46070] Basemark Web 3.0 Desktop Launcher crashes