diff options
author | phk <phk@FreeBSD.org> | 2001-03-09 20:05:06 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-03-09 20:05:06 +0000 |
commit | 49329f27991e0ea9b001b3cfede7b56001412136 (patch) | |
tree | b0da81ecbc9622f0582a1d2bb84ecbf9f23bfefe /sbin | |
parent | 219bcef498e84c0cb3c8a61cc0a6b4e806b2ad93 (diff) | |
download | FreeBSD-src-49329f27991e0ea9b001b3cfede7b56001412136.zip FreeBSD-src-49329f27991e0ea9b001b3cfede7b56001412136.tar.gz |
1) If mdconfig isn't given an action argument, it assumes detach.
2) Running `mdconfig -l` without any attached devices results in
mdconfig printing "md0" to standard output.
Submitted by: dd [1]
[1] no, not "dd(1)" but "Dima Dorfman"
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mdconfig/mdconfig.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index 231133f..6ce0e13 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -164,15 +164,16 @@ main(int argc, char **argv) i = ioctl(fd, MDIOCATTACH, &mdio); if (i < 0) err(1, "ioctl(/dev/%s)", MDCTL_NAME); - } else { + if (mdio.md_options & MD_AUTOUNIT) + printf("%s%d\n", MD_NAME, mdio.md_unit); + } else if (action == DETACH) { if (mdio.md_options & MD_AUTOUNIT) usage(); i = ioctl(fd, MDIOCDETACH, &mdio); if (i < 0) err(1, "ioctl(/dev/%s)", MDCTL_NAME); - } - if (mdio.md_options & MD_AUTOUNIT) - printf("%s%d\n", MD_NAME, mdio.md_unit); + } else + usage(); close (fd); return (0); } |