Project

General

Profile

Bug #3699 » libzfs_dataset.c.patch

Martin Matuška, 2013-04-10 11:35 AM

View differences:

usr/src/lib/libzfs/common/libzfs_dataset.c Mon Apr 08 13:11:12 2013 -0800 → usr/src/lib/libzfs/common/libzfs_dataset.c Wed Apr 10 13:29:13 2013 +0200
4116 4116
	ha.tag = tag;
4117 4117
	ha.recursive = recursive;
4118 4118
	(void) zfs_hold_one(zfs_handle_dup(zhp), &ha);
4119

  
4120
	if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) {
4121
		fnvlist_free(ha.nvl);
4122
		ret = ENOENT;
4123
		(void) snprintf(errbuf, sizeof (errbuf),
4124
		    dgettext(TEXT_DOMAIN, "cannot hold snapshot '%s@%s'"),
4125
		    zhp->zfs_name, snapname);
4126
		(void) zfs_standard_error(hdl, ret, errbuf);
4127
		return (ret);
4128
	}
4129

  
4119 4130
	ret = lzc_hold(ha.nvl, cleanup_fd, &errors);
4120 4131
	fnvlist_free(ha.nvl);
4121 4132

  
......
4217 4228
	nvlist_t *errors;
4218 4229
	nvpair_t *elem;
4219 4230
	libzfs_handle_t *hdl = zhp->zfs_hdl;
4231
	char errbuf[1024];
4220 4232

  
4221 4233
	ha.nvl = fnvlist_alloc();
4222 4234
	ha.snapname = snapname;
4223 4235
	ha.tag = tag;
4224 4236
	ha.recursive = recursive;
4225 4237
	(void) zfs_release_one(zfs_handle_dup(zhp), &ha);
4238

  
4239
	if (nvlist_next_nvpair(ha.nvl, NULL) == NULL) {
4240
		fnvlist_free(ha.nvl);
4241
		ret = ENOENT;
4242
		(void) snprintf(errbuf, sizeof (errbuf),
4243
		    dgettext(TEXT_DOMAIN,
4244
		    "cannot release hold from snapshot '%s@%s'"),
4245
		    zhp->zfs_name, snapname);
4246
		(void) zfs_standard_error(hdl, ret, errbuf);
4247
		return (ret);
4248
	}
4249

  
4226 4250
	ret = lzc_release(ha.nvl, &errors);
4227 4251
	fnvlist_free(ha.nvl);
4228 4252

  
......
4231 4255

  
4232 4256
	if (nvlist_next_nvpair(errors, NULL) == NULL) {
4233 4257
		/* no hold-specific errors */
4234
		char errbuf[1024];
4235

  
4236 4258
		(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
4237 4259
		    "cannot release"));
4238 4260
		switch (errno) {
......
4249 4271
	for (elem = nvlist_next_nvpair(errors, NULL);
4250 4272
	    elem != NULL;
4251 4273
	    elem = nvlist_next_nvpair(errors, elem)) {
4252
		char errbuf[1024];
4253

  
4254 4274
		(void) snprintf(errbuf, sizeof (errbuf),
4255 4275
		    dgettext(TEXT_DOMAIN,
4256 4276
		    "cannot release hold from snapshot '%s'"),
(1-1/2)