Add error message for missing /etc/mtab

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
This commit is contained in:
Aaron Fineman 2013-06-27 15:19:25 -04:00 committed by Brian Behlendorf
parent c12936b141
commit bbb75c1190

View 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);
}