diff options
author | Alexander Motin <mav@FreeBSD.org> | 2018-02-20 20:46:27 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2018-02-20 20:46:27 +0000 |
commit | 502b48823af3183dcc83b3b1e4e480785515a290 (patch) | |
tree | 49867fc651827613725ce629e0c90602be7fd6f7 /cddl/contrib | |
parent | 67aa4cb2b9d57606c11336e745d2584739188a43 (diff) | |
parent | 2d3fcc82a17619cdcc7a432dc1ba0e17be2c3307 (diff) | |
download | src-502b48823af3183dcc83b3b1e4e480785515a290.tar.gz src-502b48823af3183dcc83b3b1e4e480785515a290.zip |
MFV r316918: 7990 libzfs: snapspec_cb() does not need to call zfs_strdup()
illumos/illumos-gate@d8584ba6fb7a5e46da1725845b99ae5fab5a4baf
https://github.com/illumos/illumos-gate/commit/d8584ba6fb7a5e46da1725845b99ae5fab5a4baf
https://www.illumos.org/issues/7990
The snapspec_cb() callback function in libzfs does not need to call zfs_strdup().
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Marcel Telka <marcel@telka.sk>
Notes
Notes:
svn path=/head/; revision=329668
Diffstat (limited to 'cddl/contrib')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c index ac26a67a5637..ae6173e8d8f2 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c @@ -317,16 +317,17 @@ static int snapspec_cb(zfs_handle_t *zhp, void *arg) { snapspec_arg_t *ssa = arg; - char *shortsnapname; + const char *shortsnapname; int err = 0; if (ssa->ssa_seenlast) return (0); - shortsnapname = zfs_strdup(zhp->zfs_hdl, - strchr(zfs_get_name(zhp), '@') + 1); + shortsnapname = strchr(zfs_get_name(zhp), '@') + 1; if (!ssa->ssa_seenfirst && strcmp(shortsnapname, ssa->ssa_first) == 0) ssa->ssa_seenfirst = B_TRUE; + if (strcmp(shortsnapname, ssa->ssa_last) == 0) + ssa->ssa_seenlast = B_TRUE; if (ssa->ssa_seenfirst) { err = ssa->ssa_func(zhp, ssa->ssa_arg); @@ -334,10 +335,6 @@ snapspec_cb(zfs_handle_t *zhp, void *arg) zfs_close(zhp); } - if (strcmp(shortsnapname, ssa->ssa_last) == 0) - ssa->ssa_seenlast = B_TRUE; - free(shortsnapname); - return (err); } |