From owner-svn-src-stable@FreeBSD.ORG Sat Sep 12 18:16:46 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2504106568D; Sat, 12 Sep 2009 18:16:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55A748FC17; Sat, 12 Sep 2009 18:16:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CIGkBn093700; Sat, 12 Sep 2009 18:16:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CIGk3k093698; Sat, 12 Sep 2009 18:16:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909121816.n8CIGk3k093698@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 12 Sep 2009 18:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197127 - in stable/8/lib/libc: . stdio stdlib stdtime string X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2009 18:16:46 -0000 Author: kib Date: Sat Sep 12 18:16:46 2009 New Revision: 197127 URL: http://svn.freebsd.org/changeset/base/197127 Log: MFC r196861: Handle zero size for posix_memalign. Return NULL or unique address according to the 'V' option. Approved by: re (kensmith) Modified: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdio/asprintf.c (props changed) stable/8/lib/libc/stdlib/malloc.c stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/string/ffsll.c (props changed) stable/8/lib/libc/string/flsll.c (props changed) stable/8/lib/libc/string/wcpcpy.c (props changed) stable/8/lib/libc/string/wcpncpy.c (props changed) Modified: stable/8/lib/libc/stdlib/malloc.c ============================================================================== --- stable/8/lib/libc/stdlib/malloc.c Sat Sep 12 18:11:48 2009 (r197126) +++ stable/8/lib/libc/stdlib/malloc.c Sat Sep 12 18:16:46 2009 (r197127) @@ -5320,6 +5320,15 @@ posix_memalign(void **memptr, size_t ali goto RETURN; } + if (size == 0) { + if (opt_sysv == false) + size = 1; + else { + result = NULL; + ret = 0; + goto RETURN; + } + } result = ipalloc(alignment, size); }