summaryrefslogtreecommitdiff
path: root/stdio-common/tmpnam_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/tmpnam_r.c')
-rw-r--r--stdio-common/tmpnam_r.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/stdio-common/tmpnam_r.c b/stdio-common/tmpnam_r.c
index 5e67cc6845..07c4650cc0 100644
--- a/stdio-common/tmpnam_r.c
+++ b/stdio-common/tmpnam_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,8 +17,6 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
-#include <string.h>
-
/* Generate a unique filename in P_tmpdir. If S is NULL return NULL.
This makes this function thread safe. */
@@ -28,10 +26,10 @@ tmpnam_r (char *s)
if (s == NULL)
return NULL;
- /* In the following call we use the buffer pointed to by S if
- non-NULL although we don't know the size. But we limit the size
- to L_tmpnam characters in any case. */
- return __stdio_gen_tempname (s, L_tmpnam, (const char *) NULL,
- (const char *) NULL, 0,
- (size_t *) NULL, (FILE **) NULL, 0);
+ if (__path_search (s, L_tmpnam, NULL, NULL))
+ return NULL;
+ if (__gen_tempname (s, 0, 0))
+ return NULL;
+
+ return s;
}