From 23bf60be7d3d59a13435f2fc0c5ba5f74ab24c64 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 10 Jul 2009 08:48:11 +0000 Subject: [PATCH] (stat): Treat UNC file names as residing on remote drives. (Bug#3542) --- src/w32.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/w32.c b/src/w32.c index cd95f60e84f..a208b13a08d 100644 --- a/src/w32.c +++ b/src/w32.c @@ -3154,11 +3154,13 @@ stat (const char * path, struct stat * buf) } } - /* GetDriveType needs the root directory of NAME's drive. */ - if (!(strlen (name) >= 2 && IS_DEVICE_SEP (name[1]))) - devtype = GetDriveType (NULL); /* use root of current diectory */ + if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1])) + devtype = DRIVE_REMOTE; /* assume UNC name is remote */ + else if (!(strlen (name) >= 2 && IS_DEVICE_SEP (name[1]))) + devtype = GetDriveType (NULL); /* use root of current drive */ else { + /* GetDriveType needs the root directory of NAME's drive. */ strncpy (drive_root, name, 3); drive_root[3] = '\0'; devtype = GetDriveType (drive_root); -- 2.39.5