dschedctl: Don't assume /dev as devfs's mount point
authorStathis Kamperis <beket@dragonflybsd.org>
Wed, 21 Apr 2010 23:02:06 +0000 (02:02 +0300)
committerStathis Kamperis <beket@dragonflybsd.org>
Wed, 21 Apr 2010 23:02:11 +0000 (02:02 +0300)
Suggested-by: swildner@
usr.sbin/dschedctl/dschedctl.c

index 8aa0192..b9e6808 100644 (file)
@@ -149,11 +149,9 @@ int main(int argc, char *argv[])
 
        if (argc == 1) {
                dflag = 1;
-               if (strncmp(argv[0], "/dev/", 5) == 0) {
-                 disk_name = argv[0] + 5;
-               } else {
-                       disk_name = argv[0];
-               }
+               disk_name = basename(argv[0]);
+               if (!disk_name)
+                       err(1, "basename");
        } else if (argc > 1) {
                usage();
                /* NOT REACHED */