aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/os/freebsd/libzfs_compat.c
diff options
context:
space:
mode:
authorDamian Szuberski <[email protected]>2022-02-21 04:20:00 +0100
committerGitHub <[email protected]>2022-02-20 19:20:00 -0800
commit806739f991aa0d3fc5a36989fff8d8ab8fddf78f (patch)
treec486b2dd5f9d9ade96b7e5e897193607fcaa241d /lib/libzfs/os/freebsd/libzfs_compat.c
parente41013078a90d5790c737eec573ec376ca21a234 (diff)
Correct compilation errors reported by GCC 10/11
New `zfs_type_t` value `ZFS_TYPE_INVALID` is introduced. Variable initialization is now possible to make GCC happy. Reviewed by: Brian Behlendorf <[email protected]> Signed-off-by: szubersk <[email protected]> Closes #12167 Closes #13103
Diffstat (limited to 'lib/libzfs/os/freebsd/libzfs_compat.c')
-rw-r--r--lib/libzfs/os/freebsd/libzfs_compat.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libzfs/os/freebsd/libzfs_compat.c b/lib/libzfs/os/freebsd/libzfs_compat.c
index cb5a27c64..ce2dcef00 100644
--- a/lib/libzfs/os/freebsd/libzfs_compat.c
+++ b/lib/libzfs/os/freebsd/libzfs_compat.c
@@ -199,7 +199,7 @@ execvpe(const char *name, char * const argv[], char * const envp[])
return (execvPe(name, path, argv, envp));
}
-#define ERRBUFLEN 256
+#define ERRBUFLEN 1024
static __thread char errbuf[ERRBUFLEN];
@@ -207,10 +207,10 @@ const char *
libzfs_error_init(int error)
{
char *msg = errbuf;
- size_t len, msglen = ERRBUFLEN;
+ size_t msglen = sizeof (errbuf);
if (modfind("zfs") < 0) {
- len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN,
+ size_t len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN,
"Failed to load %s module: "), ZFS_KMOD);
msg += len;
msglen -= len;
@@ -285,7 +285,6 @@ zfs_jail(zfs_handle_t *zhp, int jailid, int attach)
{
libzfs_handle_t *hdl = zhp->zfs_hdl;
zfs_cmd_t zc = {"\0"};
- char errbuf[1024];
unsigned long cmd;
int ret;
@@ -314,6 +313,10 @@ zfs_jail(zfs_handle_t *zhp, int jailid, int attach)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"vdevs can not be jailed"));
return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
+ case ZFS_TYPE_INVALID:
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "invalid zfs_type_t: ZFS_TYPE_INVALID"));
+ return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
case ZFS_TYPE_POOL:
case ZFS_TYPE_FILESYSTEM:
/* OK */