Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2009 20:45:38 +0000 (UTC)
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188829 - head/sbin/atacontrol
Message-ID:  <200902192045.n1JKjc2g007412@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)");
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902192045.n1JKjc2g007412>