diff --git a/sbin/atacontrol/atacontrol.8 b/sbin/atacontrol/atacontrol.8 index d4fd109eec21..e2daea90a986 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 6199b3e07038..f6be45131127 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]);