From owner-freebsd-bugs Thu Apr 6 7: 0: 8 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id D143D37C1EF for ; Thu, 6 Apr 2000 07:00:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id HAA39935; Thu, 6 Apr 2000 07:00:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Thu, 6 Apr 2000 07:00:02 -0700 (PDT) Message-Id: <200004061400.HAA39935@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Daniel Hagan Subject: Re: bin/16924: tmpfile(3) ignores TMPDIR and always uses /tmp Reply-To: Daniel Hagan Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/16924; it has been noted by GNATS. From: Daniel Hagan To: "Lachlan O'Dea" Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/16924: tmpfile(3) ignores TMPDIR and always uses /tmp Date: Thu, 6 Apr 2000 09:56:33 -0400 (EDT) On Thu, 6 Apr 2000, Lachlan O'Dea wrote: > 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. From the information given in the man page for tmpfile(3), it would appear that the correct way to handle a malloc failure would be to return null and leave errno set to whatever value malloc(3) put there. See the RETURN VALUES and ERRORS section of the tmpfile(3) manpage. The original code is incorrect anyway since it doesn't handle malloc errors. Daniel -- Daniel Hagan Computer Science CSE dhagan@cs.vt.edu http://www.cs.vt.edu/~dhagan/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message