From 4f7fb135bda604256641454f390a03d7b805edba Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Tue, 18 Aug 2020 21:07:43 -0400 Subject: [PATCH] libzfs_core: Initialize fail_ioc_cmd to ZFS_IOC_LAST FreeBSD numbers `ZFS_IOC_*` starting at 0, so pick a different sentinel value to avoid unintentionally messing with `ZFS_IOC_POOL_CREATE` ioctls. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10729 --- lib/libzfs_core/libzfs_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libzfs_core/libzfs_core.c b/lib/libzfs_core/libzfs_core.c index d35ea523e0..50b1b9dec2 100644 --- a/lib/libzfs_core/libzfs_core.c +++ b/lib/libzfs_core/libzfs_core.c @@ -97,7 +97,7 @@ static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; static int g_refcount; #ifdef ZFS_DEBUG -static zfs_ioc_t fail_ioc_cmd; +static zfs_ioc_t fail_ioc_cmd = ZFS_IOC_LAST; static zfs_errno_t fail_ioc_err; static void @@ -118,7 +118,7 @@ libzfs_core_debug_ioc(void) * cannot checkpoint 'tank': the loaded zfs module does not support * this operation. A reboot may be required to enable this operation. */ - if (fail_ioc_cmd == 0) { + if (fail_ioc_cmd == ZFS_IOC_LAST) { char *ioc_test = getenv("ZFS_IOC_TEST"); unsigned int ioc_num = 0, ioc_err = 0;