vnconfig -l: print an error if supplied vn is unknown
authorStathis Kamperis <beket@dragonflybsd.org>
Mon, 30 Mar 2009 07:48:36 +0000 (07:48 +0000)
committerStathis Kamperis <beket@dragonflybsd.org>
Mon, 30 Mar 2009 09:56:14 +0000 (09:56 +0000)
The code as it is has no effect, because `tmp' is never NULL.
Make it behave as initially intended. Also, since we are here
replace the printf() call with errx().

Approved-by: corecode@
usr.sbin/vnconfig/vnconfig.c

index 66ec175..01a2c0f 100644 (file)
@@ -290,10 +290,8 @@ getinfo( const char *vname )
                        }
                        tmp++;
                }
-               if (tmp == NULL) {
-                       printf("unknown vn device: %s", vname);
-                       return 1;
-               }
+               if (*tmp == '\0')
+                       errx(1, "unknown vn device: %s", vname);
        }
 
        snprintf(vnpath, sizeof(vnpath), "/dev/vn%d", i);