diff options
author | bapt <bapt@FreeBSD.org> | 2015-10-14 06:31:49 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-10-14 06:31:49 +0000 |
commit | 9f9e4ddb4965b473049b1df4a9f510ca8263ccf2 (patch) | |
tree | c01261b2c603b6d4125c0a7429bce1a3fc662d54 /sbin | |
parent | 33831fe3b5010ac9dedee0fa225cf7a1c9e5d148 (diff) | |
download | FreeBSD-src-9f9e4ddb4965b473049b1df4a9f510ca8263ccf2.zip FreeBSD-src-9f9e4ddb4965b473049b1df4a9f510ca8263ccf2.tar.gz |
MFC: 288984
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'
Sponsored by: Gandi.net
Diffstat (limited to 'sbin')
-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 97628a2..c0bcc81 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -247,7 +247,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); } } |