summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-06-23 18:26:37 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-06-23 18:26:37 +0000
commit8a9de76878466efb7a3e954b44108f4b0004fbff (patch)
tree131f6a653f33bb4055f7c57829ef57a579a1a074
parent3553b6c0ebbec5ef9e65e7e091ecaaa94814fa8e (diff)
snprintf returns bytes it wanted to print, not the number it actually did
-rw-r--r--bin/chio/chio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/chio/chio.c b/bin/chio/chio.c
index 52d9cadeccc..bfb991103e6 100644
--- a/bin/chio/chio.c
+++ b/bin/chio/chio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chio.c,v 1.7 1997/11/08 23:22:40 todd Exp $ */
+/* $OpenBSD: chio.c,v 1.8 1998/06/23 18:26:36 millert Exp $ */
/* $NetBSD: chio.c,v 1.1.1.1 1996/04/03 00:34:38 thorpej Exp $ */
/*
@@ -639,6 +639,7 @@ bits_to_string(v, cp)
{
const char *np;
char f, sep, *bp;
+ size_t n;
static char buf[128];
bp = buf;
@@ -649,8 +650,9 @@ bits_to_string(v, cp)
np++;
if ((v & (1 << (f - 1))) == 0)
continue;
- bp += snprintf(bp, sizeof(buf) - (bp - &buf[0]),
+ (void)snprintf(bp, sizeof(buf) - (bp - &buf[0]),
"%c%.*s", sep, np - cp, cp);
+ bp += strlen(bp);
sep = ',';
}
if (sep != '<')