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: Simon Burge <simonb at wasabisystems dot com>
- To: Muthukumar Ratty <muthu at iqmail dot net>
- Cc: binutils at sources dot redhat dot com, Ian Lance Taylor <ian at airs dot com>,amodra at bigpond dot net dot au, hp at bitrange dot com
- Date: Wed, 2 Jul 2003 16:02:44 +1000
- Subject: Re: [patch] use mkstemp instead of mktemp.
- Organization: Wasabi Systems, Inc.
- References: <m33chpd56o.fsf@gossamer.airs.com> <Pine.LNX.4.33.0307012049150.20066-100000@Muruga.localdomain>
On Tue, Jul 01, 2003 at 09:11:27PM -0700, Muthukumar Ratty wrote:
> >
> > You can't just mechanically replace mktemp() with mkstemp(). They
> > have different return values.
> >mkstemp() returns the newly opened
> > file.
>
> and also modifies the template properly so I think it should be ok.
Note that blindly ignoring the return value of mkstemp() and then using
the modified template to open the file will create exactly the same race
condition that mkstemp() was designed to fix! You'll remove the link
time warning, but not fixed the problem the warning was warning about.
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD Development, Support and Service: http://www.wasabisystems.com/