Source-Changes-HG archive

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

[src/netbsd-1-5]: src/lib/libc/stdio Pull up revisions 1.13-1.14 (requested b...



details:   https://anonhg.NetBSD.org/src/rev/47e55f6aa22a
branches:  netbsd-1-5
changeset: 489928:47e55f6aa22a
user:      he <he%NetBSD.org@localhost>
date:      Thu Oct 19 14:04:52 2000 +0000

description:
Pull up revisions 1.13-1.14 (requested by kleink):
  C99 alignment: a buffer size of 0 is permitted.  Also, when
  size is 0, a null buffer pointer may be passed.  Fixes PR#9603.

diffstat:

 lib/libc/stdio/snprintf.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 7db4f4d60e30 -r 47e55f6aa22a lib/libc/stdio/snprintf.c
--- a/lib/libc/stdio/snprintf.c Thu Oct 19 14:03:56 2000 +0000
+++ b/lib/libc/stdio/snprintf.c Thu Oct 19 14:04:52 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: snprintf.c,v 1.12 2000/01/22 22:19:19 mycroft Exp $    */
+/*     $NetBSD: snprintf.c,v 1.12.4.1 2000/10/19 14:04:52 he Exp $     */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: snprintf.c,v 1.12 2000/01/22 22:19:19 mycroft Exp $");
+__RCSID("$NetBSD: snprintf.c,v 1.12.4.1 2000/10/19 14:04:52 he Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -75,11 +75,13 @@
        va_list ap;
        FILE f;
 
-       _DIAGASSERT(str != NULL);
+       _DIAGASSERT(n == 0 || str != NULL);
        _DIAGASSERT(fmt != NULL);
 
-       if ((int)n < 1)
+       if ((int)n < 0) {
+               errno = EINVAL;
                return (-1);
+       }
 #if __STDC__
        va_start(ap, fmt);
 #else



Home | Main Index | Thread Index | Old Index