Date: Thu, 06 Apr 2000 02:10:25 -0400 (EDT) From: Mike Heffner <mheffner@mailandnews.com> To: "Lachlan O'Dea" <lodea@vet.com.au> Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/16924: tmpfile(3) ignores TMPDIR and always uses /tmp Message-ID: <XFMail.20000406021025.mheffner@mailandnews.com> In-Reply-To: <200004060410.VAA13196@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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" <lodea@vet.com.au> | To: Daniel Hagan <dhagan@cs.vt.edu> | 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 <spock@techfour.net> * * 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20000406021025.mheffner>