Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libutil PR/48517 do not add extra '>' to string-c...



details:   https://anonhg.NetBSD.org/src/rev/46140cad0905
branches:  trunk
changeset: 796501:46140cad0905
user:      shm <shm%NetBSD.org@localhost>
date:      Fri Jun 06 07:08:37 2014 +0000

description:
PR/48517 do not add extra '>' to string-converted value when nothing matches

diffstat:

 common/lib/libutil/snprintb.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 1f1cecac2012 -r 46140cad0905 common/lib/libutil/snprintb.c
--- a/common/lib/libutil/snprintb.c     Fri Jun 06 06:59:21 2014 +0000
+++ b/common/lib/libutil/snprintb.c     Fri Jun 06 07:08:37 2014 +0000
@@ -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 @@
 #  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 @@
                }
        }
        l_len++;
-       if ((size_t)(++t_len) < buflen)
+       if (val != 0 && (size_t)(++t_len) < buflen)
                *bp++ = '>';
 terminate:
        *bp++ = '\0';



Home | Main Index | Thread Index | Old Index