diff options
-rw-r--r-- | lib/libspl/os/freebsd/getmntany.c | 4 | ||||
-rw-r--r-- | lib/libzfs/libzfs_util.c | 3 | ||||
-rw-r--r-- | lib/libzfs/os/freebsd/libzfs_compat.c | 21 |
3 files changed, 17 insertions, 11 deletions
diff --git a/lib/libspl/os/freebsd/getmntany.c b/lib/libspl/os/freebsd/getmntany.c index b41e763ce..0ef24059e 100644 --- a/lib/libspl/os/freebsd/getmntany.c +++ b/lib/libspl/os/freebsd/getmntany.c @@ -37,10 +37,6 @@ #include <sys/stat.h> #include <unistd.h> -#define BUFSIZE (MNT_LINE_MAX + 2) - -__thread char buf[BUFSIZE]; - int getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf) { diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 651bca297..a457fbfd0 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1010,8 +1010,7 @@ libzfs_init(void) int error; char *env; - error = libzfs_load_module(); - if (error) { + if ((error = libzfs_load_module()) != 0) { errno = error; return (NULL); } diff --git a/lib/libzfs/os/freebsd/libzfs_compat.c b/lib/libzfs/os/freebsd/libzfs_compat.c index 037ba56ef..2de90c7ce 100644 --- a/lib/libzfs/os/freebsd/libzfs_compat.c +++ b/lib/libzfs/os/freebsd/libzfs_compat.c @@ -176,11 +176,26 @@ execvpe(const char *name, char * const argv[], char * const envp[]) return (execvPe(name, path, argv, envp)); } +#define ERRBUFLEN 256 + +__thread static char errbuf[ERRBUFLEN]; + const char * libzfs_error_init(int error) { + char *msg = errbuf; + size_t len, msglen = ERRBUFLEN; - return (strerror(error)); + if (modfind("zfs") < 0) { + len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN, + "Failed to load %s module: "), ZFS_KMOD); + msg += len; + msglen -= len; + } + + (void) snprintf(msg, msglen, "%s", strerror(error)); + + return (errbuf); } int @@ -193,10 +208,6 @@ zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc) * Verify the required ZFS_DEV device is available and optionally attempt * to load the ZFS modules. Under normal circumstances the modules * should already have been loaded by some external mechanism. - * - * Environment variables: - * - ZFS_MODULE_LOADING="YES|yes|ON|on" - Attempt to load modules. - * - ZFS_MODULE_TIMEOUT="<seconds>" - Seconds to wait for ZFS_DEV */ int libzfs_load_module(void) |