diff lib-src/movemail.c @ 567:4a2749e56f92

[xemacs-hg @ 2001-05-24 11:21:32 by yoshiki] Karl M. Hegbloom)s patch "[configure.in,config.h.in,movemail.c] Use mkstemp if possible (warning suppression, "security")", <87g0ea77tc.fsf@bittersweet.intra.hegbloom.net>
author yoshiki
date Thu, 24 May 2001 11:22:26 +0000
parents abe6d1db359e
children b39c14581166
line wrap: on
line diff
--- a/lib-src/movemail.c	Thu May 24 11:01:54 2001 +0000
+++ b/lib-src/movemail.c	Thu May 24 11:22:26 2001 +0000
@@ -588,14 +588,20 @@
     p--;
   *p = 0;
   strcpy (p, "EXXXXXX");
+#ifndef HAVE_MKSTEMP
   mktemp (tempname);
   unlink (tempname);
+#endif
 
   for (;;)
     {
       /* Create the lock file, but not under the lock file name.  */
       /* Give up if cannot do that.  */
+#ifdef HAVE_MKSTEMP
+      desc = mkstemp (tempname);
+#else
       desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0666);
+#endif
       if (desc < 0)
 	{
 	  char *message = (char *) xmalloc (strlen (tempname) + 50);