mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Change /etc/mtab to /proc/self/mounts
Fix misleading error message: "The /dev/zfs device is missing and must be created.", if /etc/mtab is missing. Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Closes #4680 Closes #5029
This commit is contained in:
committed by
Brian Behlendorf
parent
25e2ab16be
commit
792517389f
@@ -294,11 +294,11 @@ mtab_is_writeable(void)
|
||||
struct stat st;
|
||||
int error, fd;
|
||||
|
||||
error = lstat(MNTTAB, &st);
|
||||
error = lstat("/etc/mtab", &st);
|
||||
if (error || S_ISLNK(st.st_mode))
|
||||
return (0);
|
||||
|
||||
fd = open(MNTTAB, O_RDWR | O_CREAT, 0644);
|
||||
fd = open("/etc/mtab", O_RDWR | O_CREAT, 0644);
|
||||
if (fd < 0)
|
||||
return (0);
|
||||
|
||||
@@ -320,21 +320,21 @@ mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
|
||||
mnt.mnt_freq = 0;
|
||||
mnt.mnt_passno = 0;
|
||||
|
||||
fp = setmntent(MNTTAB, "a+");
|
||||
fp = setmntent("/etc/mtab", "a+");
|
||||
if (!fp) {
|
||||
(void) fprintf(stderr, gettext(
|
||||
"filesystem '%s' was mounted, but %s "
|
||||
"filesystem '%s' was mounted, but /etc/mtab "
|
||||
"could not be opened due to error %d\n"),
|
||||
dataset, MNTTAB, errno);
|
||||
dataset, errno);
|
||||
return (MOUNT_FILEIO);
|
||||
}
|
||||
|
||||
error = addmntent(fp, &mnt);
|
||||
if (error) {
|
||||
(void) fprintf(stderr, gettext(
|
||||
"filesystem '%s' was mounted, but %s "
|
||||
"filesystem '%s' was mounted, but /etc/mtab "
|
||||
"could not be updated due to error %d\n"),
|
||||
dataset, MNTTAB, errno);
|
||||
dataset, errno);
|
||||
return (MOUNT_FILEIO);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user