This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch, libstdc++, testsuite] Modify tests to use tmpnam()
On Wed, 2010-03-03 at 14:31 -0800, Steve Ellcey wrote:
> On Wed, 2010-03-03 at 23:15 +0100, Paolo Carlini wrote:
>
> > Ok. Actually, it seems to me we should use tmpnam more consistently -
> > after all it's a perfectly standard C89 facility - instead of inventing
> > names here and there for temporary files. Can you add a one-line comment
> > about that before the arrays?
> >
> > Thanks,
> > Paolo.
>
>
> I am not sure what kind of comment you want. Maybe something like:
>
> // Use tmpnam to create a unique name for the FIFO.
>
>
> Hm, I just happened to look at the linux man page for tmpnam (as opposed
> to the HPUX one) and noticed this:
>
> | BUGS
> | Never use this function. Use mkstemp(3) or tmpfile(3) instead.
>
> But I don't think either of those routines can create a FIFO like we are
> doing in these tests so this seems like a bogus comment in the man page.
I had forgotten that GNU ld warns about use of tmpnam:
warning: the use of `tmpnam' is dangerous, better use `mkstemp'
It would be messy for the tests to turn off that warning since GNU ld
isn't the only linker used with GCC. Other tests that use tmpnam are
compile-only and do not link.
Janis