Module Name: src
Committed By: shm
Date: Fri Jun 6 07:08:37 UTC 2014
Modified Files:
src/common/lib/libutil: snprintb.c
Log Message:
PR/48517 do not add extra '>' to string-converted value when nothing matches
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/common/lib/libutil/snprintb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libutil/snprintb.c
diff -u src/common/lib/libutil/snprintb.c:1.14 src/common/lib/libutil/snprintb.c:1.15
--- src/common/lib/libutil/snprintb.c:1.14 Thu Aug 8 22:18:20 2013
+++ src/common/lib/libutil/snprintb.c Fri Jun 6 07:08:37 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: snprintb.c,v 1.14 2013/08/08 22:18:20 pgoyette Exp $ */
+/* $NetBSD: snprintb.c,v 1.15 2014/06/06 07:08:37 shm Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
# include <sys/cdefs.h>
# if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: snprintb.c,v 1.14 2013/08/08 22:18:20 pgoyette Exp $");
+__RCSID("$NetBSD: snprintb.c,v 1.15 2014/06/06 07:08:37 shm Exp $");
# endif
# include <sys/types.h>
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: snprintb.c,v 1.14 2013
# include <errno.h>
# else /* ! _KERNEL */
# include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.14 2013/08/08 22:18:20 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.15 2014/06/06 07:08:37 shm Exp $");
# include <sys/param.h>
# include <sys/inttypes.h>
# include <sys/systm.h>
@@ -257,7 +257,7 @@ snprintb_m(char *buf, size_t buflen, con
}
}
l_len++;
- if ((size_t)(++t_len) < buflen)
+ if (val != 0 && (size_t)(++t_len) < buflen)
*bp++ = '>';
terminate:
*bp++ = '\0';