diff options
author | melifaro <melifaro@FreeBSD.org> | 2014-10-31 13:37:47 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2014-10-31 13:37:47 +0000 |
commit | 71195eab36de5c701068138caa09d4865e69d0bd (patch) | |
tree | 1aacc8a17a4eba06b1224c31e69ccc143d231687 /sbin | |
parent | 2495e4b948471df01338932bff6123b06aee4063 (diff) | |
download | FreeBSD-src-71195eab36de5c701068138caa09d4865e69d0bd.zip FreeBSD-src-71195eab36de5c701068138caa09d4865e69d0bd.tar.gz |
Print human-readable error for "route not found" case.
Submitted by: vsevolod (initial version)
MFC after: 2 weeks
Sponsored by: Yandex LLC
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/route/route.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index 9b3bb95..21d92b5 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1533,9 +1533,18 @@ rtmsg(int cmd, int flags, int fib) if (debugonly) return (0); if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) { - if (errno == EPERM) + switch (errno) { + case EPERM: err(1, "writing to routing socket"); - warn("writing to routing socket"); + case ESRCH: + warnx("route has not been found"); + break; + case EEXIST: + /* Handled by newroute() */ + break; + default: + warn("writing to routing socket"); + } return (-1); } if (cmd == RTM_GET) { |