summaryrefslogtreecommitdiff
path: root/sbin/route
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2016-09-05 14:23:39 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2016-09-05 14:23:39 +0000
commit32bb854fa0dc7d8129b85acd089fa92ebe9a00bd (patch)
tree473bead826b93a2a2af6db1e1deece9a8838825f /sbin/route
parent1680ffe9b0a94fec8d45f3f1d5a54789cf571c02 (diff)
Print route labels in double quotes since they can contain spaces in the name.
OK florian@
Diffstat (limited to 'sbin/route')
-rw-r--r--sbin/route/show.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c
index 412c595ac49..73989889964 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.106 2016/09/03 14:23:14 phessler Exp $ */
+/* $OpenBSD: show.c,v 1.107 2016/09/05 14:23:38 claudio Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -297,8 +297,7 @@ p_rtentry(struct rt_msghdr *rtm)
printf(" %2d %-5.16s", rtm->rtm_priority,
if_indextoname(rtm->rtm_index, ifbuf));
if (verbose && rti_info[RTAX_LABEL])
- printf(" %s", ((struct sockaddr_rtlabel *)
- rti_info[RTAX_LABEL])->sr_label);
+ printf(" %s", routename(rti_info[RTAX_LABEL]));
putchar('\n');
}
@@ -467,11 +466,11 @@ routename(struct sockaddr *sa)
return (label_print(sa));
case AF_UNSPEC:
if (sa->sa_len == sizeof(struct sockaddr_rtlabel)) {
- static char name[RTLABEL_LEN];
+ static char name[RTLABEL_LEN + 2];
struct sockaddr_rtlabel *sr;
sr = (struct sockaddr_rtlabel *)sa;
- (void)strlcpy(name, sr->sr_label, sizeof(name));
+ snprintf(name, sizeof(name), "\"%s\"", sr->sr_label);
return (name);
}
/* FALLTHROUGH */