diff options
author | mm <mm@FreeBSD.org> | 2013-04-25 06:55:57 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2013-04-25 06:55:57 +0000 |
commit | edefb5410f10c43a2d7f973cf61637076c20e494 (patch) | |
tree | a032d413c426f615b3b497e4e12d332db05bfc20 /cddl/contrib | |
parent | 26718d463f213daa4cb92915bd0a3932f721c61a (diff) | |
download | FreeBSD-src-edefb5410f10c43a2d7f973cf61637076c20e494.zip FreeBSD-src-edefb5410f10c43a2d7f973cf61637076c20e494.tar.gz |
Respect the enoent_ok flag if reporting error for holding an non-existing
snapshot.
Related illumos ZFS issue:
3699 zfs hold or release of a non-existent snapshot does not output error
Reported by: Steven Hartland <smh@FreeBSD.org>
MFC after: 3 days
Diffstat (limited to 'cddl/contrib')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c index e1cbae3..e328711 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c @@ -4207,10 +4207,13 @@ zfs_hold(zfs_handle_t *zhp, const char *snapname, const char *tag, if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) { fnvlist_free(ha.nvl); ret = ENOENT; - (void) snprintf(errbuf, sizeof (errbuf), - dgettext(TEXT_DOMAIN, "cannot hold snapshot '%s@%s'"), - zhp->zfs_name, snapname); - (void) zfs_standard_error(hdl, ret, errbuf); + if (!enoent_ok) { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot hold snapshot '%s@%s'"), + zhp->zfs_name, snapname); + (void) zfs_standard_error(hdl, ret, errbuf); + } return (ret); } |