Workaround FUSE/Linux-kernel to try ourselves to modprobe FUSE on ENODEV.
authorlace <>
Thu, 26 Jan 2006 18:45:06 +0000 (18:45 +0000)
committerlace <>
Thu, 26 Jan 2006 18:45:06 +0000 (18:45 +0000)
 - Bugreported by: John Pratt

src/client/fuse/fusermount.c

index 65b60dc..9ceadc1 100644 (file)
@@ -792,6 +792,17 @@ static int try_open(const char *dev, char **devp, int silent)
         if ((group = getgrnam("fuse")) && !chown(dev, 0, group->gr_gid))
             fd = open(dev, O_RDWR);
     }
+    if (fd == -1 && errno == ENODEV) {
+        const char *cmd = "/sbin/modprobe fuse";
+
+        if (!system(cmd))
+            fprintf(stderr, "%s: Notice: Loaded Linux kernel module FUSE: %s\n",
+                    progname, cmd);
+        else
+            fprintf(stderr, "%s: Warning: \"%s\" cannot be opened and even failed: %s\n",
+                    progname, dev, cmd);
+        fd = open(dev, O_RDWR);
+    }
     if (fd != -1) {
         *devp = strdup(dev);
         if (*devp == NULL) {