devtab - swapon now supports /etc/devtab
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 12 Aug 2009 23:27:45 +0000 (16:27 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 12 Aug 2009 23:27:45 +0000 (16:27 -0700)
sbin/swapon/swapon.c

index ff807ec..a3e2cac 100644 (file)
@@ -67,7 +67,7 @@ main(int argc, char **argv)
        argv += optind;
 
        stat = 0;
-       if (doall)
+       if (doall) {
                while ((fsp = getfsent()) != NULL) {
                        if (strcmp(fsp->fs_type, FSTAB_SW))
                                continue;
@@ -79,10 +79,13 @@ main(int argc, char **argv)
                                printf("swapon: adding %s as swap device\n",
                                    fsp->fs_spec);
                }
-       else if (!*argv)
+       } else if (*argv == NULL) {
                usage();
-       for (; *argv; ++argv)
-               stat |= add(*argv, 0);
+       }
+       while (*argv) {
+               stat |= add(getdevpath(*argv, 0), 0);
+               ++argv;
+       }
        exit(stat);
 }