X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=lib%2Flibzfs%2Flibzfs_util.c;h=259f5fd4961572542014b7e6ebfd933ee74d3167;hb=d164b2093561a9771db07346e6fffc9ca19427a2;hp=54de0f4b50a4c3e1ff08b25288503128bb663536;hpb=172bb4bd5e4afef721dd4d2972d8680d983f144b;p=zfs.git diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 54de0f4..259f5fd 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -480,7 +480,6 @@ zfs_realloc(libzfs_handle_t *hdl, void *ptr, size_t oldsize, size_t newsize) if ((ret = realloc(ptr, newsize)) == NULL) { (void) no_memory(hdl); - free(ptr); return (NULL); } @@ -796,6 +795,10 @@ zprop_print_headers(zprop_get_cbdata_t *cbp, zfs_type_t type) cbp->cb_colwidths[GET_COL_SOURCE] = strlen(dgettext(TEXT_DOMAIN, "SOURCE")); + /* first property is always NAME */ + assert(cbp->cb_proplist->pl_prop == + ((type == ZFS_TYPE_POOL) ? ZPOOL_PROP_NAME : ZFS_PROP_NAME)); + /* * Go through and calculate the widths for each column. For the * 'source' column, we kludge it up by taking the worst-case scenario of @@ -823,9 +826,13 @@ zprop_print_headers(zprop_get_cbdata_t *cbp, zfs_type_t type) } /* - * 'VALUE' column + * 'VALUE' column. The first property is always the 'name' + * property that was tacked on either by /sbin/zfs's + * zfs_do_get() or when calling zprop_expand_list(), so we + * ignore its width. If the user specified the name property + * to display, then it will be later in the list in any case. */ - if ((pl->pl_prop != ZFS_PROP_NAME || !pl->pl_all) && + if (pl != cbp->cb_proplist && pl->pl_width > cbp->cb_colwidths[GET_COL_VALUE]) cbp->cb_colwidths[GET_COL_VALUE] = pl->pl_width; @@ -1010,9 +1017,9 @@ zfs_nicestrtonum(libzfs_handle_t *hdl, const char *value, uint64_t *num) return (-1); } - /* Rely on stroll() to process the numeric portion. */ + /* Rely on stroull() to process the numeric portion. */ errno = 0; - *num = strtoll(value, &end, 10); + *num = strtoull(value, &end, 10); /* * Check for ERANGE, which indicates that the value is too large to fit