summaryrefslogtreecommitdiff
path: root/sbin/mdconfig
diff options
context:
space:
mode:
authorFlorent Thoumie <flz@FreeBSD.org>2007-11-16 17:40:24 +0000
committerFlorent Thoumie <flz@FreeBSD.org>2007-11-16 17:40:24 +0000
commit69fcb5379c62a90a58f5e5787cb6986b1fcc457b (patch)
tree45793ed393b6918a87a08f94542f635359462e79 /sbin/mdconfig
parentd949071d71e788b6fadfbbc4a6b1651af6079c28 (diff)
downloadsrc-test2-69fcb5379c62a90a58f5e5787cb6986b1fcc457b.tar.gz
src-test2-69fcb5379c62a90a58f5e5787cb6986b1fcc457b.zip
Notes
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r--sbin/mdconfig/mdconfig.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 4de9057db909..9142b477d505 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -284,7 +284,7 @@ main(int argc, char **argv)
*/
md_list(NULL, OPT_LIST);
} else {
- md_query(mdunit);
+ return (md_query(mdunit));
}
} else if (action == ATTACH) {
if (cmdline < 2)
@@ -323,7 +323,7 @@ md_list(char *units, int opt)
struct ggeom *gg;
struct gclass *gcl;
void *sq;
- int retcode;
+ int retcode, found;
char *type, *file, *length;
type = file = length = NULL;
@@ -338,6 +338,7 @@ md_list(char *units, int opt)
if (sq == NULL)
return (-1);
+ found = 0;
while ((gsp = geom_stats_snapshot_next(sq)) != NULL) {
gid = geom_lookupid(&gm, gsp->id);
if (gid == NULL)
@@ -352,6 +353,8 @@ md_list(char *units, int opt)
retcode = md_find(units, pp->lg_name);
if (retcode != 1)
continue;
+ else
+ found = 1;
}
gc = &pp->lg_config;
printf("%s", pp->lg_name);
@@ -380,7 +383,10 @@ md_list(char *units, int opt)
printf("\n");
/* XXX: Check if it's enough to clean everything. */
geom_stats_snapshot_free(sq);
- return (-1);
+ if ((opt & OPT_UNIT) && found)
+ return (0);
+ else
+ return (-1);
}
/*