Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Oct 2015 09:28:54 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288984 - head/sbin/sysctl
Message-ID:  <201510070928.t979SsMQ057994@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Oct  7 09:28:54 2015
New Revision: 288984
URL: https://svnweb.freebsd.org/changeset/base/288984

Log:
  Only print the errno string in case sysctl(3) does not file with ENOENT
  This reduces the noise in error reporing from sysctl(8):
  
  Before:
  $ sysctl bla=something
  sysctl: unknown oid 'bla': No such file or directory
  
  After:
  $ sysctl bla=something
  sysctl: unknown oid 'bla'
  
  MFC after:	1 week
  Sponsored by:	Gandi.net

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==============================================================================
--- head/sbin/sysctl/sysctl.c	Wed Oct  7 09:12:49 2015	(r288983)
+++ head/sbin/sysctl/sysctl.c	Wed Oct  7 09:28:54 2015	(r288984)
@@ -276,7 +276,11 @@ parse(const char *string, int lineno)
 		if (qflag)
 			return (1);
 		else {
-			warn("unknown oid '%s'%s", bufp, line);
+			if (errno == ENOENT) {
+				warnx("unknown oid '%s'%s", bufp, line);
+			} else {
+				warn("unknown oid '%s'%s", bufp, line);
+			}
 			return (1);
 		}
 	}



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