Fix the clear function which has been broken for a bit.

MFC after:	1 week
This commit is contained in:
Matt Jacob 2010-07-04 22:17:56 +00:00
parent d3f4dbc513
commit 5d8d4137df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=209704

View File

@ -222,17 +222,28 @@ mp_label(struct gctl_req *req)
}
}
static void
mp_clear(struct gctl_req *req)
{
const char *name;
int error;
int error, i, nargs;
name = gctl_get_ascii(req, "arg1");
error = g_metadata_clear(name, G_MULTIPATH_MAGIC);
if (error != 0) {
fprintf(stderr, "Can't clear metadata on %s: %s.\n", name, strerror(error));
gctl_error(req, "Not fully done.");
nargs = gctl_get_int(req, "nargs");
if (nargs < 1) {
gctl_error(req, "Too few arguments.");
return;
}
for (i = 0; i < nargs; i++) {
name = gctl_get_ascii(req, "arg%d", i);
error = g_metadata_clear(name, G_MULTIPATH_MAGIC);
if (error != 0) {
fprintf(stderr, "Can't clear metadata on %s: %s.\n",
name, strerror(error));
gctl_error(req, "Not fully done.");
continue;
}
}
}