Add conditional chkconfig to packaging
[zfs.git] / lib / libnvpair / libnvpair.c
index 16bce48..b852cb6 100644 (file)
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 #include <unistd.h>
@@ -123,7 +124,7 @@ struct nvlist_prtctl {
                        (void) DFLTPRTOP(pctl, type)(pctl, \
                            DFLTPRTOPARG(pctl, type), nvl, name, val); \
                } \
-               (void) fprintf(pctl->nvprt_fp, pctl->nvprt_eomfmt); \
+               (void) fprintf(pctl->nvprt_fp, "%s", pctl->nvprt_eomfmt); \
        }
 
 #define        ARENDER(pctl, type, nvl, name, arrp, count) \
@@ -137,7 +138,7 @@ struct nvlist_prtctl {
                        (void) DFLTPRTOP(pctl, type)(pctl, \
                            DFLTPRTOPARG(pctl, type), nvl, name, arrp, count); \
                } \
-               (void) fprintf(pctl->nvprt_fp, pctl->nvprt_eomfmt); \
+               (void) fprintf(pctl->nvprt_fp, "%s", pctl->nvprt_eomfmt); \
        }
 
 static void nvlist_print_with_indent(nvlist_t *, nvlist_prtctl_t);
@@ -210,7 +211,7 @@ NVLIST_PRTFUNC(int32, int32_t, int32_t, "%d")
 NVLIST_PRTFUNC(uint32, uint32_t, uint32_t, "0x%x")
 NVLIST_PRTFUNC(int64, int64_t, longlong_t, "%lld")
 NVLIST_PRTFUNC(uint64, uint64_t, u_longlong_t, "0x%llx")
-NVLIST_PRTFUNC(double, double, double, "0x%llf")
+NVLIST_PRTFUNC(double, double, double, "0x%f")
 NVLIST_PRTFUNC(string, char *, char *, "%s")
 NVLIST_PRTFUNC(hrtime, hrtime_t, hrtime_t, "0x%llx")
 
@@ -235,7 +236,7 @@ nvaprint_##type_and_variant(nvlist_prtctl_t pctl, void *private, \
                                (void) fprintf(fp, "[%d]: ", i); \
                } \
                if (i != 0) \
-                       (void) fprintf(fp, pctl->nvprt_btwnarrfmt); \
+                       (void) fprintf(fp, "%s", pctl->nvprt_btwnarrfmt); \
                (void) fprintf(fp, vfmt, (ptype)valuep[i]); \
        } \
        return (1); \
@@ -394,11 +395,11 @@ nvlist_prtctl_dofmt(nvlist_prtctl_t pctl, enum nvlist_prtctl_fmt which, ...)
                break;
 
        case NVLIST_FMT_MEMBER_POSTAMBLE:
-               (void) fprintf(fp, pctl->nvprt_eomfmt);
+               (void) fprintf(fp, "%s", pctl->nvprt_eomfmt);
                break;
 
        case NVLIST_FMT_BTWN_ARRAY:
-               (void) fprintf(fp, pctl->nvprt_btwnarrfmt); \
+               (void) fprintf(fp, "%s", pctl->nvprt_btwnarrfmt);
                break;
 
        default:
@@ -803,6 +804,10 @@ dump_nvlist(nvlist_t *list, int indent)
 
        while ((elem = nvlist_next_nvpair(list, elem)) != NULL) {
                switch (nvpair_type(elem)) {
+               case DATA_TYPE_BOOLEAN:
+                       (void) printf("%*s%s\n", indent, "", nvpair_name(elem));
+                       break;
+
                case DATA_TYPE_BOOLEAN_VALUE:
                        (void) nvpair_value_boolean_value(elem, &bool_value);
                        (void) printf("%*s%s: %s\n", indent, "",
@@ -1216,7 +1221,7 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
                boolean_t val, val_arg;
 
                /* scanf boolean_t from value and check for match */
-               sr = sscanf(value, "%"SCNi32, &val_arg);
+               sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg);
                if ((sr == 1) &&
                    (nvpair_value_boolean_value(nvp, &val) == 0) &&
                    (val == val_arg))
@@ -1227,7 +1232,7 @@ nvpair_value_match_regex(nvpair_t *nvp, int ai,
                boolean_t *val_array, val_arg;
 
                /* check indexed value of array for match */
-               sr = sscanf(value, "%"SCNi32, &val_arg);
+               sr = sscanf(value, "%"SCNi32, (int32_t *)&val_arg);
                if ((sr == 1) &&
                    (nvpair_value_boolean_array(nvp,
                    &val_array, &a_len) == 0) &&