From owner-freebsd-current Fri Nov 22 10:24:39 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E92BF37B48D for ; Fri, 22 Nov 2002 10:24:35 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id C42F743E6E for ; Fri, 22 Nov 2002 10:24:34 -0800 (PST) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b144.otenet.gr [212.205.244.152]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id gAMIOUU6010806; Fri, 22 Nov 2002 20:24:31 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.6/8.12.6) with ESMTP id gAMIOQ1I066600; Fri, 22 Nov 2002 20:24:28 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by gothmog.gr (8.12.6/8.12.6/Submit) id gAMFhgP1000629; Fri, 22 Nov 2002 17:43:42 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 22 Nov 2002 17:43:42 +0200 From: Giorgos Keramidas To: Marc Recht Cc: freebsd-current@FreeBSD.org Subject: Re: malloc(0) broken? Message-ID: <20021122154342.GA584@gothmog.gr> References: <79620000.1037978720@leeloo.intern.geht.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <79620000.1037978720@leeloo.intern.geht.de> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-11-22 16:25, Marc Recht wrote: > Hi! > > A malloc(0) returns always 0x800 on my system. This causes some third-party > software to fail, because they expect malloc(0) to return NULL. Is this a > bug or a feature? malloc(3) doesn't mention anything. malloc(3) does mention something. Look at the description of the V malloc option. In the manpage you will also find various ways of turning this option on or off for your programs. : V Attempting to allocate zero bytes will return a NULL pointer : instead of a valid pointer. (The default behavior is to make a : minimal allocation and return a pointer to it.) This option is : provided for System V compatibility. This option is incompatible : with the ``X'' option. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message