This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] use mkstemp instead of mktemp.
On Tue, Jul 01, 2003 at 09:11:27PM -0700, Muthukumar Ratty wrote:
> Does this sound ok? Also mkstemp opens the file... that increments
> the file reference count? So close it in make_tempname before returning?
I think the nicest solution would be to throw out make_tempname and
replace it with create_tempfile. create_tempfile should handle all the
file/dir creation, and return both a file descriptor and the temp file
name (for cases when you want to rename and keep the file).
/* Creates a temporary file in the same directory as NAME, and returns
its file descriptor. NEWNAME is set to the path of the file. If
FLAGS include O_DIRECTORY, then the temp file is a directory.
On failure, -1 is returned. */
int create_tempfile (const char *name, int flags, char *newname);
--
Alan Modra
IBM OzLabs - Linux Technology Centre