This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] use mkstemp instead of mktemp.
- From: Muthukumar Ratty <muthu at iqmail dot net>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: <binutils at sources dot redhat dot com>
- Date: Tue, 1 Jul 2003 23:37:36 -0700 (PDT)
- Subject: Re: [patch] use mkstemp instead of mktemp.
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
>
>