libzfs: use zfs_strerror() in place of strerror()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Richard Kojedzinszky <richard@kojedz.in>
Closes #15793
This commit is contained in:
Richard Kojedzinszky
2024-01-23 00:28:18 +01:00
committed by Tony Hutter
parent 18c8abc8aa
commit a1ea40af86
12 changed files with 65 additions and 47 deletions
+6 -6
View File
@@ -1291,7 +1291,7 @@ zpool_find_import_scan_dir(libpc_handle_t *hdl, pthread_mutex_t *lock,
if (error == ENOENT)
return (0);
zutil_error_aux(hdl, "%s", strerror(error));
zutil_error_aux(hdl, "%s", zfs_strerror(error));
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN,
"cannot resolve path '%s'"), dir);
return (error);
@@ -1300,7 +1300,7 @@ zpool_find_import_scan_dir(libpc_handle_t *hdl, pthread_mutex_t *lock,
dirp = opendir(path);
if (dirp == NULL) {
error = errno;
zutil_error_aux(hdl, "%s", strerror(error));
zutil_error_aux(hdl, "%s", zfs_strerror(error));
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN,
"cannot open '%s'"), path);
return (error);
@@ -1362,7 +1362,7 @@ zpool_find_import_scan_path(libpc_handle_t *hdl, pthread_mutex_t *lock,
goto out;
}
zutil_error_aux(hdl, "%s", strerror(error));
zutil_error_aux(hdl, "%s", zfs_strerror(error));
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN,
"cannot resolve path '%s'"), dir);
goto out;
@@ -1400,7 +1400,7 @@ zpool_find_import_scan(libpc_handle_t *hdl, pthread_mutex_t *lock,
if (error == ENOENT)
continue;
zutil_error_aux(hdl, "%s", strerror(error));
zutil_error_aux(hdl, "%s", zfs_strerror(error));
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(
TEXT_DOMAIN, "cannot resolve path '%s'"), dir[i]);
goto error;
@@ -1644,14 +1644,14 @@ zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg)
verify(iarg->poolname == NULL || iarg->guid == 0);
if ((fd = open(iarg->cachefile, O_RDONLY | O_CLOEXEC)) < 0) {
zutil_error_aux(hdl, "%s", strerror(errno));
zutil_error_aux(hdl, "%s", zfs_strerror(errno));
(void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN,
"failed to open cache file"));
return (NULL);
}
if (fstat64(fd, &statbuf) != 0) {
zutil_error_aux(hdl, "%s", strerror(errno));
zutil_error_aux(hdl, "%s", zfs_strerror(errno));
(void) close(fd);
(void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN,
"failed to get size of cache file"));