ntdll: prefers regular file over loopback device

Austin English austinenglish at gmail.com
Tue Jul 21 15:25:33 CDT 2009


See bug 10974 http://bugs.winehq.org/show_bug.cgi?id=10974.

Patch by Robert Millan.

-- 
-Austin
-------------- next part --------------
From 856e1c75bff77f1b0a67233f7f1eb97e722aaefe Mon Sep 17 00:00:00 2001
From: Robert Millan <rmh at aybabtu.com>
Date: Tue, 21 Jul 2009 15:23:37 -0500
Subject: [PATCH] ntdll: prefers regular file over loopback device

---
 dlls/ntdll/directory.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index bccfba6..da87512 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -377,14 +377,19 @@ static char *parse_mount_entries( FILE *f, dev_t dev, ino_t ino )
                 return device + 4;
             }
         }
-        else if (!stat( entry->mnt_fsname, &st ) && S_ISREG(st.st_mode))
+        else if (stat( entry->mnt_fsname, &st ) == -1)
         {
-            /* if device is a regular file check for a loop mount */
+            /* if device doesn't exist check if it's a loop mount, for
+             * which a loopback device will be available even if device file
+             * was removed */
             if ((device = strstr( entry->mnt_opts, "loop=" )))
             {
-                char *p = strchr( device + 5, ',' );
+                device += 5;
+                char *p = strchr( device, ',' );
                 if (p) *p = 0;
-                return device + 5;
+                if (stat( device, &st ) == -1) continue;
+                WARN("Loopback file %s not found, using %s instead\n", entry->mnt_fsname, device);
+                return device;
             }
         }
         else
-- 
1.5.4.3


More information about the wine-patches mailing list