[PATCH] server: Print a warning if home and config directories are equal.

Bernhard Übelacker bernhardu at mailbox.org
Fri Dec 10 16:37:22 CST 2021


Signed-off-by: Bernhard Übelacker <bernhardu at mailbox.org>
----
I observed today the comdlg32:itemdlg test failing because it could
not find c:/home/user/Desktop, which itself is a link to $HOME,
which got ignored because $HOME and $WINEPREFIX were the same.
Maybe a warning like could help to avoid such a misconfiguration.
---
 server/request.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/request.c b/server/request.c
index 7021741c765..5248ba93bba 100644
--- a/server/request.c
+++ b/server/request.c
@@ -612,6 +612,7 @@ static void create_dir( const char *name, struct stat *st )
 /* create the server directory and chdir to it */
 static char *create_server_dir( int force )
 {
+    const char *home = getenv( "HOME" );
     const char *prefix = getenv( "WINEPREFIX" );
     char *p, *config_dir;
     struct stat st, st2;
@@ -629,7 +630,6 @@ static char *create_server_dir( int force )
     }
     else
     {
-        const char *home = getenv( "HOME" );
         if (!home)
         {
             struct passwd *pwd = getpwuid( getuid() );
@@ -654,6 +654,8 @@ static char *create_server_dir( int force )
         fatal_error( "stat %s: %s\n", config_dir, strerror( errno ));
     if (st.st_uid != getuid())
         fatal_error( "%s is not owned by you\n", config_dir );
+    if (home && strcmp(home, config_dir) == 0) /* see init_files: ignore_file( config_dir ) */
+        fprintf( stderr, "wineserver: config_dir equals home directory; will not get returned in directory searches.\n" );
 
     /* create the base directory if needed */
 
-- 
2.33.0




More information about the wine-devel mailing list