mount_devfs - don't unconditionally clear rules
authorAlex Hornung <ahornung@gmail.com>
Sun, 21 Nov 2010 10:03:39 +0000 (10:03 +0000)
committerAlex Hornung <ahornung@gmail.com>
Sun, 21 Nov 2010 10:03:39 +0000 (10:03 +0000)
* mount_devfs was unconditionally clearing all rules of a mountpoint
  after mounting.

* According to the man page (and my original intentions, I'd presume),
  mount_devfs should only clear the rules of a mountpoint if it was
  already mounted. So fix mount_devfs accordingly.

Dragonfly-bug: http://bugs.dragonflybsd.org/issue1885

sbin/mount_devfs/mount_devfs.c

index 59a138b..de6fd07 100644 (file)
@@ -145,14 +145,14 @@ main(int argc, char **argv)
        if (!mounted) {
                if (mount(vfc.vfc_name, mntpoint, mntflags, &info))
                        err(1, NULL);
-       }
-
-       if (fork() == 0) {
-               execlp("devfsctl", "devfsctl",
-                   "-m", mntpoint,
-                       "-c",
-                       "-r",
-                       NULL);
+       } else {
+               if (fork() == 0) {
+                       execlp("devfsctl", "devfsctl",
+                           "-m", mntpoint,
+                               "-c",
+                               "-r",
+                               NULL);
+               }
        }
 
        if (info.flags & DEVFS_MNT_RULESET) {