summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/mktemp.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-12-28 02:33:10 +0000
committerderaadt <deraadt@openbsd.org>1996-12-28 02:33:10 +0000
commit5cf55735242c985ac2bb63bb45a916eddaf36316 (patch)
tree33e5e3b89c91d92b980394bb3fd824fc517b426d /lib/libc/stdio/mktemp.c
parentsuggest alternative in ld warn message (diff)
downloadwireguard-openbsd-5cf55735242c985ac2bb63bb45a916eddaf36316.tar.xz
wireguard-openbsd-5cf55735242c985ac2bb63bb45a916eddaf36316.zip
95% of common uses of these are incorrect and insecure. correct use is
incredibly rare. Time for some education!
Diffstat (limited to 'lib/libc/stdio/mktemp.c')
-rw-r--r--lib/libc/stdio/mktemp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c
index c7642ee30ae..bc69c6f265f 100644
--- a/lib/libc/stdio/mktemp.c
+++ b/lib/libc/stdio/mktemp.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: mktemp.c,v 1.2 1996/08/19 08:32:55 tholo Exp $";
+static char rcsid[] = "$OpenBSD: mktemp.c,v 1.3 1996/12/28 02:33:10 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -54,13 +54,26 @@ mkstemp(path)
return (_gettemp(path, &fd) ? fd : -1);
}
+char *_mktemp __P((char *));
+
char *
-mktemp(path)
+_mktemp(path)
char *path;
{
return(_gettemp(path, (int *)NULL) ? path : (char *)NULL);
}
+__warn_references(mktemp,
+ "warning: mktemp() possibly used unsafely; consider using mkstemp()");
+
+char *
+mktemp(path)
+ char *path;
+{
+ return(_mktemp(path));
+}
+
+
static int
_gettemp(path, doopen)
char *path;