fusermount improvement
authorMiklos Szeredi <miklos@szeredi.hu>
Fri, 18 Aug 2006 19:26:23 +0000 (19:26 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Fri, 18 Aug 2006 19:26:23 +0000 (19:26 +0000)
ChangeLog
util/fusermount.c

index 8ddf02642c0193d57f0f3c7614c65f994e91cd3d..a549ab2833c40b20eba44b3704e44c36a0e1e14c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,11 @@
        the kernel tree) the statfs method will receive the path within
        the filesystem on which the stat(v)fs syscall was called.
 
+       * fusermount: try to modprobe fuse module if invoked by root and
+       unable to open device.  This is needed with udev, since the device
+       node will be created only when the module is inserted, hence
+       module autoloading won't work.  Reported by Szakacsits Szabolcs
+
 2006-07-30  Miklos Szeredi <miklos@szeredi.hu>
 
        * fusermount: if selinux is active, restore the original file's
index 6d3ef975013bb9a33d1a1252d2bfc2c14fccefe6..89ecb2c7e242b78c63353966c626eb1e0f3b7dfc 100644 (file)
@@ -841,14 +841,23 @@ static int try_open_fuse_device(char **devp)
 
 static int open_fuse_device(char **devp)
 {
-    int fd = try_open_fuse_device(devp);
-    if (fd >= 0)
+    int fd;
+
+    if (getuid() == 0) {
+        fd = try_open_fuse_device(devp);
+        if (fd >= -1)
+            return fd;
+
+        system("modprobe fuse");
+    }
+
+    fd = try_open_fuse_device(devp);
+    if (fd >= -1)
         return fd;
 
-    if (fd == -2)
-        fprintf(stderr,
-                "%s: fuse device not found, try 'modprobe fuse' first\n",
-                progname);
+    fprintf(stderr, "%s: fuse device not found, try 'modprobe fuse' first\n",
+            progname);
+
     return -1;
 }