[patch] use mkstemp instead of mktemp.
Muthukumar Ratty
muthu@iqmail.net
Wed Jul 2 06:45:00 GMT 2003
On Wed, 2 Jul 2003, Alan Modra wrote:
> 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);
Cool. that is neat. I will send one soon :)
Muthu
>
>
More information about the Binutils
mailing list