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 <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org>
Closes #10729
This commit is contained in:
Ryan Moeller 2020-08-18 21:07:43 -04:00 committed by GitHub
parent 716b53d0a1
commit 4f7fb135bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
static int g_refcount; static int g_refcount;
#ifdef ZFS_DEBUG #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 zfs_errno_t fail_ioc_err;
static void static void
@ -118,7 +118,7 @@ libzfs_core_debug_ioc(void)
* cannot checkpoint 'tank': the loaded zfs module does not support * cannot checkpoint 'tank': the loaded zfs module does not support
* this operation. A reboot may be required to enable this operation. * 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"); char *ioc_test = getenv("ZFS_IOC_TEST");
unsigned int ioc_num = 0, ioc_err = 0; unsigned int ioc_num = 0, ioc_err = 0;