diff options
author | hrs <hrs@FreeBSD.org> | 2014-10-09 23:17:18 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2014-10-09 23:17:18 +0000 |
commit | 5500c83bb6f1a11a88e41099ddf76cfdfd6c0e02 (patch) | |
tree | 94873858c2c521cc6e8da774a62fdd96dba39ea7 /sbin/mdconfig | |
parent | 0f665a39d5332b9c69687c9f7ecfe500cd47daba (diff) | |
download | FreeBSD-src-5500c83bb6f1a11a88e41099ddf76cfdfd6c0e02.zip FreeBSD-src-5500c83bb6f1a11a88e41099ddf76cfdfd6c0e02.tar.gz |
MFC r257036:
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.
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r-- | sbin/mdconfig/mdconfig.c | 18 |
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); } /* |