svn commit: r188829 - head/sbin/atacontrol

Roman Divacky rdivacky at FreeBSD.org
Thu Feb 19 12:45:38 PST 2009


Author: rdivacky
Date: Thu Feb 19 20:45:37 2009
New Revision: 188829
URL: http://svn.freebsd.org/changeset/base/188829

Log:
  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)

Modified:
  head/sbin/atacontrol/atacontrol.c

Modified: head/sbin/atacontrol/atacontrol.c
==============================================================================
--- head/sbin/atacontrol/atacontrol.c	Thu Feb 19 20:07:59 2009	(r188828)
+++ head/sbin/atacontrol/atacontrol.c	Thu Feb 19 20:45:37 2009	(r188829)
@@ -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)");
 		}


More information about the svn-src-head mailing list