From 190e541ba084c770df94864ecba33d5ed3d94a2d Mon Sep 17 00:00:00 2001 From: rdivacky Date: Thu, 19 Feb 2009 20:45:37 +0000 Subject: 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 Approved by: kib (mentor) --- sbin/atacontrol/atacontrol.c | 2 ++ 1 file changed, 2 insertions(+) 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)"); } -- cgit v1.1