This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Hide reference to mktemp in libpthread


mktemp is no longer in POSIX, and this also avoids the link warning when
linking -lpthread statically.

Andreas.

	[BZ #14327]
	* include/stdlib.h (__mktemp): Add declaration.
	* misc/mktemp.c (__mktemp): Renamed from mktemp, add weak alias.
	* misc/Versions (GLIBC_PRIVATE): Add __mktemp.

	* sem_open.c (sem_open): Use __mktemp instead of mktemp.

diff --git a/include/stdlib.h b/include/stdlib.h
index d45b2f0..2e53664 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -77,6 +77,7 @@ extern struct drand48_data __libc_drand48_data attribute_hidden;
 extern int __setenv (const char *__name, const char *__value, int __replace);
 extern int __unsetenv (const char *__name);
 extern int __clearenv (void);
+extern char *__mktemp (char *__template) __THROW __nonnull ((1));
 extern char *__canonicalize_file_name (const char *__name);
 extern char *__realpath (const char *__name, char *__resolved);
 extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
diff --git a/misc/Versions b/misc/Versions
index 64632f0..ec5aea7 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -151,6 +151,7 @@ libc {
   }
   GLIBC_PRIVATE {
     __madvise;
+    __mktemp;
     __libc_ifunc_impl_list;
   }
 }
diff --git a/misc/mktemp.c b/misc/mktemp.c
index 9886c5d..55421fd 100644
--- a/misc/mktemp.c
+++ b/misc/mktemp.c
@@ -22,7 +22,7 @@
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the filename unique.  */
 char *
-mktemp (template)
+__mktemp (template)
      char *template;
 {
   if (__gen_tempname (template, 0, 0, __GT_NOCREATE) < 0)
@@ -31,5 +31,6 @@ mktemp (template)
 
   return template;
 }
+weak_alias (__mktemp, mktemp)
 
 link_warning (mktemp, "the use of `mktemp' is dangerous, better use `mkstemp'")
diff --git a/nptl/sem_open.c b/nptl/sem_open.c
index 5bc56c5..83b2fdf 100644
--- a/nptl/sem_open.c
+++ b/nptl/sem_open.c
@@ -329,7 +329,7 @@ sem_open (const char *name, int oflag, ...)
 	     since the file must be opened with a specific mode.  The
 	     mode cannot later be set since then we cannot apply the
 	     file create mask.  */
-	  if (mktemp (tmpfname) == NULL)
+	  if (__mktemp (tmpfname) == NULL)
 	    return SEM_FAILED;
 
 	  /* Open the file.  Make sure we do not overwrite anything.  */
-- 
1.8.1

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]