PATCH: / and cwd handling

Marcus Meissner marcus at jet.franken.de
Tue Jul 9 23:11:57 CDT 2002


Hi Alexandre,

Your last patch to DRIVE_FindDriveRoot broke drives with Path="/".

(You can see the problem if you create a fallback drive with /, 
 the try to start wine in a directory not listed otherwise.)

I create a workaround, but probably something can be done in the
main while() loop.

Ciao, Marcus

License: LGPL
Changelog:
        Fixed broken find root for drives with "/" as path.

Index: files/drive.c
===================================================================
RCS file: /home/wine/wine/files/drive.c,v
retrieving revision 1.74
diff -u -r1.74 drive.c
--- files/drive.c	20 Jun 2002 23:21:27 -0000	1.74
+++ files/drive.c	10 Jul 2002 05:14:52 -0000
@@ -429,7 +429,24 @@
             while (len > 0 && buffer[len - 1] == '/') buffer[--len] = 0;
         }
     }
+    /* Buffer is now "", so just check if we have a / fallback drive.  */
+    stat( "/", &st );
+    for (drive = 0; drive < MAX_DOS_DRIVES; drive++)
+    {
+       if (!DOSDrives[drive].root ||
+	   (DOSDrives[drive].flags & DRIVE_DISABLED))
+	   continue;
 
+       if ((DOSDrives[drive].dev == st.st_dev) &&
+	   (DOSDrives[drive].ino == st.st_ino))
+       {
+	   TRACE( "%s -> drive %c:, root='%s', name='%s'\n",
+	       *path, 'A' + drive, buffer, *path + len);
+	   *path += len;
+	   if (!**path) *path = "\\";
+	   return drive;
+       }
+    }
     return -1;
 }
 



More information about the wine-patches mailing list