Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/1e63d8063061
branches:  netbsd-7
changeset: 800324:1e63d8063061
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Sep 04 06:21:45 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).

diffstat:

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

diffs (28 lines):

diff -r c83020a22d17 -r 1e63d8063061 lib/libc/stdlib/merge.c
--- a/lib/libc/stdlib/merge.c   Mon Sep 04 06:15:02 2017 +0000
+++ b/lib/libc/stdlib/merge.c   Mon Sep 04 06:21:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: merge.c,v 1.14 2012/03/13 21:13:48 christos Exp $      */
+/*     $NetBSD: merge.c,v 1.14.10.1 2017/09/04 06:21:45 snj 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.14 2012/03/13 21:13:48 christos Exp $");
+__RCSID("$NetBSD: merge.c,v 1.14.10.1 2017/09/04 06:21:45 snj Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -125,6 +125,9 @@
                return (-1);
        }
 
+       if (nmemb == 0)
+               return (0);
+
        /*
         * XXX
         * Stupid subtraction for the Cray.



Home | Main Index | Thread Index | Old Index