summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/tmpnam.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/tmpnam.c')
-rw-r--r--lib/libc/stdio/tmpnam.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/stdio/tmpnam.c b/lib/libc/stdio/tmpnam.c
index dba536067b3..15f68b02d9e 100644
--- a/lib/libc/stdio/tmpnam.c
+++ b/lib/libc/stdio/tmpnam.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: tmpnam.c,v 1.2 1996/08/19 08:33:10 tholo Exp $";
+static char rcsid[] = "$OpenBSD: tmpnam.c,v 1.3 1996/12/28 02:33:15 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -43,6 +43,11 @@ static char rcsid[] = "$OpenBSD: tmpnam.c,v 1.2 1996/08/19 08:33:10 tholo Exp $"
#include <stdio.h>
#include <unistd.h>
+__warn_references(tmpnam,
+ "warning: tmpnam() possibly used unsafely; consider using mkstemp()");
+
+extern char *_mktemp __P((char *));
+
char *
tmpnam(s)
char *s;
@@ -54,5 +59,5 @@ tmpnam(s)
s = buf;
(void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXX", P_tmpdir, tmpcount);
++tmpcount;
- return (mktemp(s));
+ return (_mktemp(s));
}