comparison 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
comparison
equal deleted inserted replaced
566:e62e90435c57 567:4a2749e56f92
586 p = tempname + strlen (tempname); 586 p = tempname + strlen (tempname);
587 while (p != tempname && !IS_DIRECTORY_SEP (p[-1])) 587 while (p != tempname && !IS_DIRECTORY_SEP (p[-1]))
588 p--; 588 p--;
589 *p = 0; 589 *p = 0;
590 strcpy (p, "EXXXXXX"); 590 strcpy (p, "EXXXXXX");
591 #ifndef HAVE_MKSTEMP
591 mktemp (tempname); 592 mktemp (tempname);
592 unlink (tempname); 593 unlink (tempname);
594 #endif
593 595
594 for (;;) 596 for (;;)
595 { 597 {
596 /* Create the lock file, but not under the lock file name. */ 598 /* Create the lock file, but not under the lock file name. */
597 /* Give up if cannot do that. */ 599 /* Give up if cannot do that. */
600 #ifdef HAVE_MKSTEMP
601 desc = mkstemp (tempname);
602 #else
598 desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0666); 603 desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0666);
604 #endif
599 if (desc < 0) 605 if (desc < 0)
600 { 606 {
601 char *message = (char *) xmalloc (strlen (tempname) + 50); 607 char *message = (char *) xmalloc (strlen (tempname) + 50);
602 sprintf (message, "%s--see source file lib-src/movemail.c", 608 sprintf (message, "%s--see source file lib-src/movemail.c",
603 tempname); 609 tempname);