svn commit: r197833 - head/usr.sbin/cdcontrol

Jaakko Heinonen jh at FreeBSD.org
Wed Oct 7 13:25:23 UTC 2009


Author: jh
Date: Wed Oct  7 13:25:22 2009
New Revision: 197833
URL: http://svn.freebsd.org/changeset/base/197833

Log:
  When run() returns an error, print the error message also in
  non-interactive mode. Previously error messages were printed only in
  interactive mode.
  
  PR:		bin/124517
  Approved by:	trasz (mentor)
  MFC after:	1 month

Modified:
  head/usr.sbin/cdcontrol/cdcontrol.c

Modified: head/usr.sbin/cdcontrol/cdcontrol.c
==============================================================================
--- head/usr.sbin/cdcontrol/cdcontrol.c	Wed Oct  7 13:12:43 2009	(r197832)
+++ head/usr.sbin/cdcontrol/cdcontrol.c	Wed Oct  7 13:25:22 2009	(r197833)
@@ -241,7 +241,7 @@ int main (int argc, char **argv)
 
 	if (argc > 0) {
 		char buf[80], *p;
-		int len;
+		int len, rc;
 
 		for (p=buf; argc-->0; ++argv) {
 			len = strlen (*argv);
@@ -257,7 +257,11 @@ int main (int argc, char **argv)
 		}
 		*p = 0;
 		arg = parse (buf, &cmd);
-		return (run (cmd, arg));
+		rc = run (cmd, arg);
+		if (rc < 0 && verbose)
+			warn(NULL);
+
+		return (rc);
 	}
 
 	if (verbose == 1)


More information about the svn-src-all mailing list