summaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_dataset.c
diff options
context:
space:
mode:
authorAndrew Stormont <[email protected]>2018-06-17 11:53:29 +0100
committerBrian Behlendorf <[email protected]>2018-10-03 09:49:30 -0700
commit84ddd4b0629be52ca7c519043cc2d155ac3ef7af (patch)
tree51344f1dd74f8cc21598225c1d27ac24efbfca9a /lib/libzfs/libzfs_dataset.c
parent52ce99dd617369ff09d8eef8cfd36fa80dbfca4f (diff)
OpenZFS 9616 - Bogus error when attempting to set property on read-only pool
Authored by: Andrew Stormont <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Approved by: Robert Mustacchi <[email protected]> Ported-by: Brian Behlendorf <[email protected]> OpenZFS-issue: https://illumos.org/issues/9616 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/f62db44d Closes #7974
Diffstat (limited to 'lib/libzfs/libzfs_dataset.c')
-rw-r--r--lib/libzfs/libzfs_dataset.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c
index 76a316a9c..b6dd4f166 100644
--- a/lib/libzfs/libzfs_dataset.c
+++ b/lib/libzfs/libzfs_dataset.c
@@ -29,7 +29,7 @@
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2017 Nexenta Systems, Inc.
* Copyright 2016 Igor Kozhukhov <[email protected]>
- * Copyright 2017 RackTop Systems.
+ * Copyright 2017-2018 RackTop Systems.
*/
#include <ctype.h>
@@ -1939,13 +1939,18 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props)
ret = zfs_ioctl(hdl, ZFS_IOC_SET_PROP, &zc);
if (ret != 0) {
+ if (zc.zc_nvlist_dst_filled == B_FALSE) {
+ (void) zfs_standard_error(hdl, errno, errbuf);
+ goto error;
+ }
+
/* Get the list of unset properties back and report them. */
nvlist_t *errorprops = NULL;
if (zcmd_read_dst_nvlist(hdl, &zc, &errorprops) != 0)
goto error;
- for (elem = nvlist_next_nvpair(nvl, NULL);
+ for (nvpair_t *elem = nvlist_next_nvpair(errorprops, NULL);
elem != NULL;
- elem = nvlist_next_nvpair(nvl, elem)) {
+ elem = nvlist_next_nvpair(errorprops, elem)) {
prop = zfs_name_to_prop(nvpair_name(elem));
zfs_setprop_error(hdl, prop, errno, errbuf);
}