summaryrefslogtreecommitdiffstats
path: root/sbin/mdconfig
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2013-10-24 01:06:44 +0000
committerhrs <hrs@FreeBSD.org>2013-10-24 01:06:44 +0000
commit3beb1e4f495288edc679a6ba32cdc1e02e24d910 (patch)
tree439a461ade1914f9c549302ec3520cc83e425b0e /sbin/mdconfig
parente5fa6b795de5add86c4883e36f8d3c4bb0dc6838 (diff)
downloadFreeBSD-src-3beb1e4f495288edc679a6ba32cdc1e02e24d910.zip
FreeBSD-src-3beb1e4f495288edc679a6ba32cdc1e02e24d910.tar.gz
Return 0 if:
1. "-u N" specified, no -f, and mdN found, 2. no -u, "-f /pathname" specified, and mdN associated with /pathname found, 3. "-u N" specified, "-f /pathname" specified, and both of them found, 4. "-l" specified and no -f, 5. "-l" specified, "-f /pathname" specified, and /pathname found. otherwise return -1. Spotted by: Julian H. Stacey
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r--sbin/mdconfig/mdconfig.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 233058d..4257dd7 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -481,12 +481,18 @@ md_list(const char *units, int opt, const char *fflag)
printf("\n");
/* XXX: Check if it's enough to clean everything. */
geom_stats_snapshot_free(sq);
- if (((opt & OPT_UNIT) && (fflag == NULL) && ufound) ||
- ((opt & OPT_UNIT) == 0 && (fflag != NULL) && ffound) ||
- ((opt & OPT_UNIT) && (fflag != NULL) && ufound && ffound))
- return (0);
- else
- return (-1);
+ if (opt & OPT_UNIT) {
+ if (((fflag == NULL) && ufound) ||
+ ((fflag == NULL) && (units != NULL) && ufound) ||
+ ((fflag != NULL) && ffound) ||
+ ((fflag != NULL) && (units != NULL) && ufound && ffound))
+ return (0);
+ } else if (opt & OPT_LIST) {
+ if ((fflag == NULL) ||
+ ((fflag != NULL) && ffound))
+ return (0);
+ }
+ return (-1);
}
/*
OpenPOWER on IntegriCloud