diff options
author | bapt <bapt@FreeBSD.org> | 2015-10-07 09:28:54 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-10-07 09:28:54 +0000 |
commit | 8a05965c7726b144472bd7736c22167bf25819e5 (patch) | |
tree | b331424af19cbaced9bde328a566c6a9f81e845f /sbin/sysctl | |
parent | 58e0a4096fe55cc3548ea668f795925a29276273 (diff) | |
download | FreeBSD-src-8a05965c7726b144472bd7736c22167bf25819e5.zip FreeBSD-src-8a05965c7726b144472bd7736c22167bf25819e5.tar.gz |
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
Diffstat (limited to 'sbin/sysctl')
-rw-r--r-- | sbin/sysctl/sysctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 8d67644..62f12b5 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -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); } } |