Skip to content

Commit 4fe95ad

Browse files
committed
mount_zfs: print strerror instead of errno for error reporting.
Tracking down an error message with the errno value can be difficult, using strerror makes the error message clearer. Signed-off-by: Érico Rolim <[email protected]>
1 parent 83b698d commit 4fe95ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cmd/mount_zfs/mount_zfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
133133
if (!fp) {
134134
(void) fprintf(stderr, gettext(
135135
"filesystem '%s' was mounted, but /etc/mtab "
136-
"could not be opened due to error %d\n"),
137-
dataset, errno);
136+
"could not be opened due to error: %s\n"),
137+
dataset, strerror(errno));
138138
return (MOUNT_FILEIO);
139139
}
140140

141141
error = addmntent(fp, &mnt);
142142
if (error) {
143143
(void) fprintf(stderr, gettext(
144144
"filesystem '%s' was mounted, but /etc/mtab "
145-
"could not be updated due to error %d\n"),
146-
dataset, errno);
145+
"could not be updated due to error %s\n"),
146+
dataset, strerror(errno));
147147
return (MOUNT_FILEIO);
148148
}
149149

@@ -223,8 +223,8 @@ main(int argc, char **argv)
223223
/* canonicalize the mount point */
224224
if (realpath(argv[1], mntpoint) == NULL) {
225225
(void) fprintf(stderr, gettext("filesystem '%s' cannot be "
226-
"mounted at '%s' due to canonicalization error %d.\n"),
227-
dataset, argv[1], errno);
226+
"mounted at '%s' due to canonicalization error: %s\n"),
227+
dataset, argv[1], strerror(errno));
228228
return (MOUNT_SYSERR);
229229
}
230230

0 commit comments

Comments
 (0)