about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-06-15 22:19:44 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-06-15 22:19:44 +0000
commitbd6302eae03648fe191dd08a53f05bb24647adff (patch)
treef5433c19d16c10bd47335de0c31090e56c4cda76
parent3f6a9e4522205efb2e404d81ae44ad45df44d79b (diff)
downloadzsh-bd6302eae03648fe191dd08a53f05bb24647adff.tar.gz
zsh-bd6302eae03648fe191dd08a53f05bb24647adff.tar.xz
zsh-bd6302eae03648fe191dd08a53f05bb24647adff.zip
Use mkstemp where available
-rw-r--r--ChangeLog5
-rw-r--r--Src/utils.c3
-rw-r--r--zshconfig.ac2
3 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a065aadcb..ead850f1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-06-16  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
+
+	* 14939: zshconfig.ac, Src/utils.c: Some systems with GNU-based
+	utilities scream at you for using mktemp() instead of mkstemp().
+
 2001-06-15  Peter Stephenson  <pws@csr.com>
 
 	* 14929: Src/params.c: after 14915, assigning to individual
diff --git a/Src/utils.c b/Src/utils.c
index 6bede2e43..1bd4afeca 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1101,12 +1101,15 @@ gettempname(void)
     if (!(s = getsparam("TMPPREFIX")))
 	s = DEFAULT_TMPPREFIX;
  
+#ifdef HAVE_MKSTEMP
+    ret = ((char *) mkstemp(dyncat(unmeta(s), "XXXXXX")));
 #ifdef HAVE__MKTEMP
     /* Zsh uses mktemp() safely, so silence the warnings */
     ret = ((char *) _mktemp(dyncat(unmeta(s), "XXXXXX")));
 #else
     ret = ((char *) mktemp(dyncat(unmeta(s), "XXXXXX")));
 #endif
+#endif
     unqueue_signals();
 
     return ret;
diff --git a/zshconfig.ac b/zshconfig.ac
index 37f9ca2d5..78cc59def 100644
--- a/zshconfig.ac
+++ b/zshconfig.ac
@@ -915,7 +915,7 @@ AC_CHECK_FUNCS(strftime difftime gettimeofday \
 	       readlink faccessx fchdir ftruncate \
 	       fstat lstat lchown \
 	       fseeko ftello \
-	       mkfifo _mktemp \
+	       mkfifo _mktemp mkstemp \
 	       waitpid wait3 \
 	       sigaction sigblock sighold sigrelse sigsetmask sigprocmask \
 	       killpg setpgid setpgrp tcsetpgrp tcgetattr nice \