Source-Changes-HG archive

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

[src/netbsd-6]: src/lib/libc/stdlib Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/99d3722e0371
branches:  netbsd-6
changeset: 777246:99d3722e0371
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Aug 31 15:05:50 2017 +0000

description:
Pull up following revision(s) (requested by ginsbach in ticket #1495):
        lib/libc/stdlib/merge.c: revision 1.15
PR lib/50316: Gracefully handle a zero number of members argument.
Taken from FreeBSD (which fixed this same issue long ago).
XXX: pullup-8
XXX: pullup-7
XXX: pullup-6

diffstat:

 lib/libc/stdlib/merge.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r afcf4fd7eb2f -r 99d3722e0371 lib/libc/stdlib/merge.c
--- a/lib/libc/stdlib/merge.c   Thu Aug 31 13:43:19 2017 +0000
+++ b/lib/libc/stdlib/merge.c   Thu Aug 31 15:05:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: merge.c,v 1.13 2011/05/18 19:36:36 dsl Exp $   */
+/*     $NetBSD: merge.c,v 1.13.6.1 2017/08/31 15:05:50 martin Exp $    */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)merge.c      8.2 (Berkeley) 2/14/94";
 #else
-__RCSID("$NetBSD: merge.c,v 1.13 2011/05/18 19:36:36 dsl Exp $");
+__RCSID("$NetBSD: merge.c,v 1.13.6.1 2017/08/31 15:05:50 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -128,6 +128,9 @@
                return (-1);
        }
 
+       if (nmemb == 0)
+               return (0);
+
        /*
         * XXX
         * Stupid subtraction for the Cray.



Home | Main Index | Thread Index | Old Index