Skip to content

Commit 36b8654

Browse files
committed
Use mkstemp instead of mktemp in thread test, per Jan.
1 parent a1ccbb9 commit 36b8654

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/tools/thread/thread_test.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.30 2004/05/28 18:37:10 momjian Exp $
9+
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.31 2004/06/09 15:16:17 momjian Exp $
1010
*
1111
* This program tests to see if your standard libc functions use
1212
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -104,7 +104,8 @@ main(int argc, char *argv[])
104104
{
105105
pthread_t thread1,
106106
thread2;
107-
107+
int fd;
108+
108109
if (argc > 1)
109110
{
110111
fprintf(stderr, "Usage: %s\n", argv[0]);
@@ -120,11 +121,13 @@ main(int argc, char *argv[])
120121
/* Make temp filenames, might not have strdup() */
121122
temp_filename_1 = malloc(strlen(TEMP_FILENAME_1) + 1);
122123
strcpy(temp_filename_1, TEMP_FILENAME_1);
123-
mktemp(temp_filename_1);
124+
fd = mkstemp(temp_filename_1);
125+
close(fd);
124126

125127
temp_filename_2 = malloc(strlen(TEMP_FILENAME_2) + 1);
126128
strcpy(temp_filename_2, TEMP_FILENAME_2);
127-
mktemp(temp_filename_2);
129+
fd = mkstemp(temp_filename_2);
130+
close(fd);
128131

129132
#if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R)
130133
if (gethostname(myhostname, MAXHOSTNAMELEN) != 0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy