summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-02-19 20:45:37 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-02-19 20:45:37 +0000
commit190e541ba084c770df94864ecba33d5ed3d94a2d (patch)
treeb777d0d059b8a4df5264ae78cf97224556a370ce /sbin
parenta95a0aafc4f4312f1ddef311c2bb08aebaeb9e07 (diff)
downloadFreeBSD-src-190e541ba084c770df94864ecba33d5ed3d94a2d.zip
FreeBSD-src-190e541ba084c770df94864ecba33d5ed3d94a2d.tar.gz
Display an error message when the requested mode is not known. So the user can
distinguish between a typo in the mode name and that the device does not support a certain mode (till now both causes show the same result, i.e. the old mode is displayed). Submitted by: Christoph Mallon <christoph.mallon gmx.de> Approved by: kib (mentor)
Diffstat (limited to 'sbin')
-rw-r--r--sbin/atacontrol/atacontrol.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sbin/atacontrol/atacontrol.c b/sbin/atacontrol/atacontrol.c
index cf4a0ff..bfd7c97 100644
--- a/sbin/atacontrol/atacontrol.c
+++ b/sbin/atacontrol/atacontrol.c
@@ -364,6 +364,8 @@ main(int argc, char **argv)
fd = open_dev(argv[2], O_RDONLY);
if (argc == 4) {
mode = str2mode(argv[3]);
+ if (mode == -1)
+ errx(1, "unknown mode");
if (ioctl(fd, IOCATASMODE, &mode) < 0)
warn("ioctl(IOCATASMODE)");
}
OpenPOWER on IntegriCloud