Date: Fri, 31 Oct 2014 13:37:47 +0000 (UTC) From: "Alexander V. Chernikov" <melifaro@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273906 - head/sbin/route Message-ID: <201410311337.s9VDblDt028920@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: melifaro Date: Fri Oct 31 13:37:47 2014 New Revision: 273906 URL: https://svnweb.freebsd.org/changeset/base/273906 Log: Print human-readable error for "route not found" case. Submitted by: vsevolod (initial version) MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Fri Oct 31 12:21:43 2014 (r273905) +++ head/sbin/route/route.c Fri Oct 31 13:37:47 2014 (r273906) @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410311337.s9VDblDt028920>