]> granicus.if.org Git - zfs/commitdiff
OpenZFS 6447 - handful of nvpair cleanups
authorSteve Dougherty <sdougherty@barracuda.com>
Wed, 11 Nov 2015 00:41:10 +0000 (19:41 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 30 Aug 2017 19:04:27 +0000 (12:04 -0700)
Authored by: Steve Dougherty <sdougherty@barracuda.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Reviewed-by: Don Brady <dev.fs.zfs@gmail.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov>
OpenZFS-issue: https://www.illumos.org/issues/6447
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/759e89b
Closes #6581

lib/libnvpair/libnvpair.c
module/nvpair/nvpair.c

index 7e24dd8445d4a245c48eff5b537b41bd2acc561e..0cf38c9505c487385a648f84f068ba7cfc111c49 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include <unistd.h>
-#include <strings.h>
+#include <string.h>
 #include <libintl.h>
 #include <sys/types.h>
 #include <sys/inttypes.h>
@@ -1219,7 +1219,8 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
                break;
        }
        case DATA_TYPE_BOOLEAN_VALUE: {
-               boolean_t val, val_arg;
+               int32_t val_arg;
+               boolean_t val;
 
                /* scanf boolean_t from value and check for match */
                sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg);
@@ -1230,7 +1231,8 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
                break;
        }
        case DATA_TYPE_BOOLEAN_ARRAY: {
-               boolean_t *val_array, val_arg;
+               boolean_t *val_array;
+               int32_t val_arg;
 
                /* check indexed value of array for match */
                sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg);
index 24ef61e936f790070219c1cc34afe036e94bc19a..c0155f729b3e581f8cb6db9eb2ea8d9a97227a34 100644 (file)
@@ -1642,6 +1642,8 @@ nvlist_lookup_nvpair_ei_sep(nvlist_t *nvl, const char *name, const char sep,
        if ((nvl == NULL) || (name == NULL))
                return (EINVAL);
 
+       sepp = NULL;
+       idx = 0;
        /* step through components of name */
        for (np = name; np && *np; np = sepp) {
                /* ensure unique names */