This is the mail archive of the
mailing list for the GCC project.
Re: tmpnam and mkstemp
- To: gcc at gcc dot gnu dot org, hkrit at openave dot com
- Subject: Re: tmpnam and mkstemp
- From: Mike Stump <mrs at windriver dot com>
- Date: Tue, 23 Jan 2001 09:39:43 -0800 (PST)
> Date: Tue, 23 Jan 2001 09:19:43 -0800
> From: habib <email@example.com>
> To: "gnu.org" <firstname.lastname@example.org>
> I get this surprising diagnostic:
> the use of `tmpnam' is dangerous, better use `mkstemp'
> when compiling code that uses the ANSI-C function tmpnam()
> with gcc 2.95.2 on redhat 7. I did not use to get this diagnostic
> with egcs 1.1.2.
> Is anybody else experiencing this?
Yes, it is a feature.
> What might be causing it?
There is special code in the software to enable gcc to provide this
warning to you.
The compiler is trying to inform you that the use of tmpnam is
dangerous, and that if your maintaining the code, that you should fix
the code. Please complain to the vendor of your software that you are
compiling, if you wish to see it fixed. If you don't care, you can
just ignore it. The code will behave just as it did with the egcs
For additional information, you might try a good UNIX C programming
book, or comp.lang.c, or one of the UNIX groups or the glibc list.
If you don't know what a comp.lang.c is, try www.deja.com under
Hope this helps.