Add error message for missing /etc/mtab
authorAaron Fineman <abyxcos@gmail.com>
Thu, 27 Jun 2013 19:19:25 +0000 (15:19 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 27 Jun 2013 21:43:37 +0000 (14:43 -0700)
The zpool command should not silently fail when the /etc/mtab
file does not exist.  This can occur in an initramfs environment
when the /etc/mtab file hasn't yet been generated.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1541

lib/libzfs/libzfs_util.c

index a4e1255..5bb88e9 100644 (file)
@@ -704,6 +704,8 @@ libzfs_init(void)
        if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {
 #endif
                (void) close(hdl->libzfs_fd);
+               (void) fprintf(stderr,
+                   gettext("mtab is not present at %s.\n"), MNTTAB);
                free(hdl);
                return (NULL);
        }