summaryrefslogtreecommitdiff
path: root/sbin/route
diff options
context:
space:
mode:
authorJared Yanovich <jaredy@cvs.openbsd.org>2004-10-14 15:20:57 +0000
committerJared Yanovich <jaredy@cvs.openbsd.org>2004-10-14 15:20:57 +0000
commit676f016b28efbea1be1a46a22bf74ce906d7e360 (patch)
tree8167b1ac9b1bce6af78f214d11a6bc30693116eb /sbin/route
parent42cbbcdc7c610668a63489b65e1fdf183fd84e4a (diff)
avoid collision of variable "err" with err()
use errx() after strlcpy if out of space style nits/knf ok henning hshoexer
Diffstat (limited to 'sbin/route')
-rw-r--r--sbin/route/route.c18
-rw-r--r--sbin/route/show.c19
2 files changed, 20 insertions, 17 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 35eeea45094..187fd444f74 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.80 2004/10/13 22:54:35 jaredy Exp $ */
+/* $OpenBSD: route.c,v 1.81 2004/10/14 15:20:56 jaredy Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94";
#else
-static const char rcsid[] = "$OpenBSD: route.c,v 1.80 2004/10/13 22:54:35 jaredy Exp $";
+static const char rcsid[] = "$OpenBSD: route.c,v 1.81 2004/10/14 15:20:56 jaredy Exp $";
#endif
#endif /* not lint */
@@ -341,7 +341,7 @@ set_metric(char *value, int key)
int
newroute(int argc, char **argv)
{
- char *cmd, *dest = "", *gateway = "", *err;
+ char *cmd, *dest = "", *gateway = "", *error;
int ishost = 0, ret = 0, attempts, oerrno, flags = RTF_STATIC;
int key;
struct hostent *hp = 0;
@@ -554,19 +554,19 @@ newroute(int argc, char **argv)
if (ret != 0) {
switch (oerrno) {
case ESRCH:
- err = "not in table";
+ error = "not in table";
break;
case EBUSY:
- err = "entry in use";
+ error = "entry in use";
break;
case ENOBUFS:
- err = "routing table overflow";
+ error = "routing table overflow";
break;
default:
- err = strerror(oerrno);
+ error = strerror(oerrno);
break;
}
- (void) printf(": %s\n", err);
+ (void) printf(": %s\n", error);
}
}
return (ret != 0);
@@ -1420,6 +1420,6 @@ getlabel(char *name)
if (strlcpy(so_label.rtlabel.sr_label, name,
sizeof(so_label.rtlabel.sr_label)) >=
sizeof(so_label.rtlabel.sr_label))
- err(1, "label too long");
+ errx(1, "label too long");
rtm_addrs |= RTA_LABEL;
}
diff --git a/sbin/route/show.c b/sbin/route/show.c
index 295717b3a05..1b1973a98eb 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.37 2004/09/24 01:24:30 jaredy Exp $ */
+/* $OpenBSD: show.c,v 1.38 2004/10/14 15:20:56 jaredy Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static const char rcsid[] = "$OpenBSD: show.c,v 1.37 2004/09/24 01:24:30 jaredy Exp $";
+static const char rcsid[] = "$OpenBSD: show.c,v 1.38 2004/10/14 15:20:56 jaredy Exp $";
#endif
#endif /* not lint */
@@ -364,9 +364,12 @@ routename(struct sockaddr *sa)
cp = NULL;
}
- if (sa->sa_len == 0)
+ if (sa->sa_len == 0) {
(void) strlcpy(line, "default", sizeof line);
- else switch (sa->sa_family) {
+ return (line);
+ }
+
+ switch (sa->sa_family) {
case AF_INET:
return
(routename4(((struct sockaddr_in *)sa)->sin_addr.s_addr));
@@ -513,14 +516,14 @@ netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask)
struct sockaddr_in6 sin6;
u_char *p;
int masklen, final = 0, illegal = 0;
- int i, lim;
+ int i, lim, flag, error;
char hbuf[NI_MAXHOST];
+
#ifdef NI_WITHSCOPEID
- int flag = NI_WITHSCOPEID;
+ flag = NI_WITHSCOPEID;
#else
- int flag = 0;
+ flag = 0;
#endif
- int error;
sin6 = *sa6;