summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2016-07-09 20:39:17 +0000
committertedu <tedu@openbsd.org>2016-07-09 20:39:17 +0000
commit9c77f16b1f5b0a214e9ca6944ac2246bad23d7c8 (patch)
tree88c71c98eb1f46e9bb149c96b6f34d065150fe35
parentDo not treat PATH_INFO as a complete path if it doesn't contain (diff)
downloadwireguard-openbsd-9c77f16b1f5b0a214e9ca6944ac2246bad23d7c8.tar.xz
wireguard-openbsd-9c77f16b1f5b0a214e9ca6944ac2246bad23d7c8.zip
only print one error, not multiple misleading messages
-rw-r--r--sbin/route/route.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index e070fcd0af3..8fd08ef97e6 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.183 2016/06/07 01:29:38 tedu Exp $ */
+/* $OpenBSD: route.c,v 1.184 2016/07/09 20:39:17 tedu Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -644,8 +644,11 @@ newroute(int argc, char **argv)
} else
break;
}
- if (*cmd == 'g')
+ if (*cmd == 'g') {
+ if (ret != 0 && qflag == 0)
+ warn("writing to routing socket");
exit(0);
+ }
oerrno = errno;
if (!qflag) {
printf("%s %s %s", cmd, ishost ? "host" : "net", dest);
@@ -1165,8 +1168,6 @@ rtmsg(int cmd, int flags, int fmask, uint8_t prio)
if (debugonly)
return (0);
if (write(s, &m_rtmsg, l) != l) {
- if (qflag == 0)
- warn("writing to routing socket");
return (-1);
}
if (cmd == RTM_GET) {