Fix gcc uninitialized variable warnings
[zfs.git] / lib / libzfs / libzfs_util.c
index 01b7c87..8277bdb 100644 (file)
@@ -571,13 +571,13 @@ zfs_nicenum(uint64_t num, char *buf, size_t buflen)
        u = " KMGTPE"[index];
 
        if (index == 0) {
-               (void) snprintf(buf, buflen, "%llu", n);
+               (void) snprintf(buf, buflen, "%llu", (u_longlong_t) n);
        } else if ((num & ((1ULL << 10 * index) - 1)) == 0) {
                /*
                 * If this is an even multiple of the base, always display
                 * without any decimal precision.
                 */
-               (void) snprintf(buf, buflen, "%llu%c", n, u);
+               (void) snprintf(buf, buflen, "%llu%c", (u_longlong_t) n, u);
        } else {
                /*
                 * We want to choose a precision that reflects the best choice
@@ -724,7 +724,7 @@ zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len)
                len = 16 * 1024;
        zc->zc_nvlist_dst_size = len;
        if ((zc->zc_nvlist_dst = (uint64_t)(uintptr_t)
-           zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == NULL)
+           zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == 0)
                return (-1);
 
        return (0);
@@ -740,8 +740,7 @@ zcmd_expand_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc)
 {
        free((void *)(uintptr_t)zc->zc_nvlist_dst);
        if ((zc->zc_nvlist_dst = (uint64_t)(uintptr_t)
-           zfs_alloc(hdl, zc->zc_nvlist_dst_size))
-           == NULL)
+           zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == 0)
                return (-1);
 
        return (0);
@@ -957,7 +956,7 @@ zprop_print_one_property(const char *name, zprop_get_cbdata_t *cbp,
     const char *source, const char *recvd_value)
 {
        int i;
-       const char *str;
+       const char *str = NULL;
        char buf[128];
 
        /*