diff options
author | 2017-08-11 16:28:29 +0000 | |
---|---|---|
committer | 2017-08-11 16:28:29 +0000 | |
commit | 72c906afffc1ef4d38dcc929b6f444ecf0af2671 (patch) | |
tree | 40190c16c8ab306e391dc33d2dde60e427baa6ae /usr.bin/ctfconv/parse.c | |
parent | display MRU each sessions in npppctl session command (diff) | |
download | wireguard-openbsd-72c906afffc1ef4d38dcc929b6f444ecf0af2671.tar.xz wireguard-openbsd-72c906afffc1ef4d38dcc929b6f444ecf0af2671.zip |
Do not insert random name for anonymous member.
Diffstat (limited to 'usr.bin/ctfconv/parse.c')
-rw-r--r-- | usr.bin/ctfconv/parse.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/usr.bin/ctfconv/parse.c b/usr.bin/ctfconv/parse.c index 3cfa227a387..5ce2f275105 100644 --- a/usr.bin/ctfconv/parse.c +++ b/usr.bin/ctfconv/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.2 2017/08/11 14:58:56 jasper Exp $ */ +/* $OpenBSD: parse.c,v 1.3 2017/08/11 16:28:30 mpi Exp $ */ /* * Copyright (c) 2016-2017 Martin Pieuchot @@ -233,7 +233,7 @@ it_dup(struct itype *it) copit->it_nelems = it->it_nelems; TAILQ_FOREACH(im, &it->it_members, im_next) { - copim = im_new(im->im_name, im->im_ref, im->im_off); + copim = im_new(im_name(im), im->im_ref, im->im_off); copim->im_refp = im->im_refp; TAILQ_INSERT_TAIL(&copit->it_members, copim, im_next); } @@ -367,7 +367,7 @@ im_new(const char *name, size_t ref, size_t off) im->im_off = off; im->im_refp = NULL; if (name == NULL) { - im->im_flags = ITM_ANON; + im->im_flags = IMF_ANON; } else { size_t n; @@ -381,6 +381,15 @@ im_new(const char *name, size_t ref, size_t off) return im; } +const char * +im_name(struct imember *im) +{ + if (!(im->im_flags & IMF_ANON)) + return im->im_name; + + return NULL; +} + void cu_stat(void) { @@ -436,10 +445,9 @@ cu_resolve(struct dwcu *dcu, struct itype_queue *cutq, struct ioff_tree *cuot) if (toresolve) printf(": %d members", toresolve); TAILQ_FOREACH(im, &it->it_members, im_next) { - if (im->im_refp == NULL) { - printf("\n%zu: %s", im->im_ref, - im->im_name); - } + if (im->im_refp != NULL) + continue; + printf("\n%zu: %s", im->im_ref, im_name(im)); } printf("\n"); } |