Print human-readable error for "route not found" case.

Submitted by:	vsevolod (initial version)
MFC after:	2 weeks
Sponsored by:	Yandex LLC
This commit is contained in:
melifaro 2014-10-31 13:37:47 +00:00
parent 2495e4b948
commit 71195eab36

View File

@ -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) {