From owner-freebsd-bugs Wed Apr 5 23:10:59 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from MailAndNews.com (MailAndNews.com [199.29.68.160]) by hub.freebsd.org (Postfix) with ESMTP id 1B05C37BFAA for ; Wed, 5 Apr 2000 23:10:53 -0700 (PDT) (envelope-from mheffner@mailandnews.com) Received: from muriel.penguinpowered.com [208.138.199.92] (mheffner@mailandnews.com); Thu, 6 Apr 2000 02:10:44 -0400 X-WM-Posted-At: MailAndNews.com; Thu, 6 Apr 00 02:10:44 -0400 Content-Length: 1528 Message-ID: X-Mailer: XFMail 1.4.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200004060410.VAA13196@freefall.freebsd.org> Date: Thu, 06 Apr 2000 02:10:25 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: "Lachlan O'Dea" Subject: Re: bin/16924: tmpfile(3) ignores TMPDIR and always uses /tmp Cc: freebsd-bugs@FreeBSD.org Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On 06-Apr-2000 Lachlan O'Dea wrote: | The following reply was made to PR bin/16924; it has been noted by GNATS. | | From: "Lachlan O'Dea" | To: Daniel Hagan | Cc: freebsd-gnats-submit@FreeBSD.org | Subject: Re: bin/16924: tmpfile(3) ignores TMPDIR and always uses /tmp | Date: Thu, 6 Apr 2000 14:03:55 +1000 | | On Wed, Apr 05, 2000 at 09:54:37PM -0400, Daniel Hagan wrote: | > You need to do error checking on your calls to malloc. Other than that, | I | > think it looks ok on an initial reading. (I'm certainly not an expert | on | > libc though.) | | Thanks for looking at this. I wanted to include error checking, but I | wasn't sure of what action to take if an error occurred. I remember | finding some other malloc calls in libc that didn't check for errors, so | I just left it alone. If anyone can point me to an example of how to | handle this, I'd appreciate it. Well, the manpage for tmpfile(3) says it will return NULL on failure and either fdopen(3) or mkstemp(3) would set errno, so, to stay consistent, you should return NULL on a malloc failure, and malloc wouuld set errno = ENOMEM. You will probably want to add this to the manpage as well. hope that helps, /**************************************** * Mike Heffner * * Fredericksburg, VA ICQ# 882073 * * Sent at: 06-Apr-2000 -- 01:59:32 EST * * http://my.ispchannel.com/~mheffner * ****************************************/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message