diff options
author | sos <sos@FreeBSD.org> | 2002-03-10 13:59:00 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2002-03-10 13:59:00 +0000 |
commit | 7acee01805ecc92ac3a018999080e51c9b1f287c (patch) | |
tree | ee05e0cd96c113b9ea6601f05a405005380ac6a2 /sbin/atacontrol | |
parent | a3b6b34c1b00df50ae89d2840d9a62ea6397c651 (diff) | |
download | FreeBSD-src-7acee01805ecc92ac3a018999080e51c9b1f287c.zip FreeBSD-src-7acee01805ecc92ac3a018999080e51c9b1f287c.tar.gz |
Check the <channel> arg a bit more.
Submitted by: David Malone <dwmalone@maths.tcd.ie>
Diffstat (limited to 'sbin/atacontrol')
-rw-r--r-- | sbin/atacontrol/atacontrol.8 | 8 | ||||
-rw-r--r-- | sbin/atacontrol/atacontrol.c | 9 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sbin/atacontrol/atacontrol.8 b/sbin/atacontrol/atacontrol.8 index d4fd109..e2daea9 100644 --- a/sbin/atacontrol/atacontrol.8 +++ b/sbin/atacontrol/atacontrol.8 @@ -68,8 +68,10 @@ subsystem. can cause severe system crashes and loss of data if used improperly, please exercise caution when using this command! .Pp -.Nm -supports the following commands: +The +.Ar channel +argument is the number of the ata channel on which to operate. +The following commands are supported: .Bl -tag -width "attach" .It Ic attach Attach an ATA @@ -122,7 +124,7 @@ Show info about all attached devices on all active controllers. The .Nm utility first appeared in -.Fx 5.0 . +.Fx 4.6 . .Sh AUTHORS .An -nosplit The diff --git a/sbin/atacontrol/atacontrol.c b/sbin/atacontrol/atacontrol.c index 6199b3e..f6be451 100644 --- a/sbin/atacontrol/atacontrol.c +++ b/sbin/atacontrol/atacontrol.c @@ -242,8 +242,13 @@ main(int argc, char **argv) bzero(&iocmd, sizeof(struct ata_cmd)); - if (argc > 2) - iocmd.channel = atoi(argv[2]); + if (argc > 2) { + int chan; + if (!(sscanf(argv[2], "%d", &chan) == 1 || + sscanf(argv[2], "ata%d", &chan) == 1)) + usage(); + iocmd.channel = chan; + } if (argc > 3) master = atoi(argv[3]); |