vnconfig -l: handle gracefully missing regular file
authorStathis Kamperis <ekamperi@gmail.com>
Mon, 2 Mar 2009 09:16:19 +0000 (09:16 +0000)
committerSascha Wildner <saw@online.de>
Sun, 22 Mar 2009 19:16:24 +0000 (20:16 +0100)
Check if VNIOCGET failed to retrieve the path of the regular
file, that is associated with the respective vn device. If so,
treat this kind of error as non-fatal (with respect to the rest
of the vn devices).

usr.sbin/vnconfig/vnconfig.c

index d1f89d1..dc84b76 100644 (file)
@@ -320,9 +320,17 @@ getinfo( const char *vname )
                else {
                        if (ioctl(vd, VNIOCGET, &vnu) == -1) {
                                if (errno != ENXIO) {
-                                       err(1, "ioctl: %s", vname);
-                                       close(vd);
-                                       return 1;
+                                       if (*vnu.vnu_file == '\0') {
+                                               fprintf(stdout,
+                                                   "vn%d: ioctl: can't access regular file\n",
+                                                   vnu.vnu_unit);
+                                               continue;
+                                       }
+                                       else {
+                                               err(1, "ioctl: %s", vname);
+                                               close(vd);
+                                               return 1;
+                                       }
                                }
                        }