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.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
Closes #11303
This commit is contained in:
Érico Nogueira Rolim 2020-12-10 02:24:59 -03:00 committed by GitHub
parent 1e4667af32
commit 957f9681eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -110,8 +110,8 @@ mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
if (!fp) { if (!fp) {
(void) fprintf(stderr, gettext( (void) fprintf(stderr, gettext(
"filesystem '%s' was mounted, but /etc/mtab " "filesystem '%s' was mounted, but /etc/mtab "
"could not be opened due to error %d\n"), "could not be opened due to error: %s\n"),
dataset, errno); dataset, strerror(errno));
return (MOUNT_FILEIO); return (MOUNT_FILEIO);
} }
@ -119,8 +119,8 @@ mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
if (error) { if (error) {
(void) fprintf(stderr, gettext( (void) fprintf(stderr, gettext(
"filesystem '%s' was mounted, but /etc/mtab " "filesystem '%s' was mounted, but /etc/mtab "
"could not be updated due to error %d\n"), "could not be updated due to error: %s\n"),
dataset, errno); dataset, strerror(errno));
return (MOUNT_FILEIO); return (MOUNT_FILEIO);
} }
@ -200,8 +200,8 @@ main(int argc, char **argv)
/* canonicalize the mount point */ /* canonicalize the mount point */
if (realpath(argv[1], mntpoint) == NULL) { if (realpath(argv[1], mntpoint) == NULL) {
(void) fprintf(stderr, gettext("filesystem '%s' cannot be " (void) fprintf(stderr, gettext("filesystem '%s' cannot be "
"mounted at '%s' due to canonicalization error %d.\n"), "mounted at '%s' due to canonicalization error: %s\n"),
dataset, argv[1], errno); dataset, argv[1], strerror(errno));
return (MOUNT_SYSERR); return (MOUNT_SYSERR);
} }