aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/movemail.c
diff options
context:
space:
mode:
authorMiles Bader2008-01-30 07:57:28 +0000
committerMiles Bader2008-01-30 07:57:28 +0000
commitd235ca2ff8fab139ce797757fcb159d1e28fa7e0 (patch)
tree96c5cd1a06a0d9dc26e8470c6eabfc032c0046f3 /lib-src/movemail.c
parent3709a060f679dba14df71ae64a0035fa2b5b3106 (diff)
parent02cbe062bee38a6705bafb1699d77e3c44cfafcf (diff)
downloademacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.tar.gz
emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
Diffstat (limited to 'lib-src/movemail.c')
-rw-r--r--lib-src/movemail.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 7c647676ff5..1f95735878d 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -113,7 +113,7 @@ Boston, MA 02110-1301, USA. */
113#define R_OK 4 113#define R_OK 4
114#endif 114#endif
115 115
116#if defined (XENIX) || defined (WINDOWSNT) 116#ifdef WINDOWSNT
117#include <sys/locking.h> 117#include <sys/locking.h>
118#endif 118#endif
119 119
@@ -388,13 +388,13 @@ main (argc, argv)
388 if (indesc < 0) 388 if (indesc < 0)
389 pfatal_with_name (inname); 389 pfatal_with_name (inname);
390 390
391#if defined (BSD_SYSTEM) || defined (XENIX) 391#ifdef BSD_SYSTEM
392 /* In case movemail is setuid to root, make sure the user can 392 /* In case movemail is setuid to root, make sure the user can
393 read the output file. */ 393 read the output file. */
394 /* This is desirable for all systems 394 /* This is desirable for all systems
395 but I don't want to assume all have the umask system call */ 395 but I don't want to assume all have the umask system call */
396 umask (umask (0) & 0333); 396 umask (umask (0) & 0333);
397#endif /* BSD_SYSTEM || XENIX */ 397#endif /* BSD_SYSTEM */
398 outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666); 398 outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666);
399 if (outdesc < 0) 399 if (outdesc < 0)
400 pfatal_with_name (outname); 400 pfatal_with_name (outname);
@@ -422,15 +422,11 @@ main (argc, argv)
422#ifdef MAIL_USE_LOCKF 422#ifdef MAIL_USE_LOCKF
423 status = lockf (indesc, F_LOCK, 0); 423 status = lockf (indesc, F_LOCK, 0);
424#else /* not MAIL_USE_LOCKF */ 424#else /* not MAIL_USE_LOCKF */
425#ifdef XENIX
426 status = locking (indesc, LK_RLCK, 0L);
427#else
428#ifdef WINDOWSNT 425#ifdef WINDOWSNT
429 status = locking (indesc, LK_RLCK, -1L); 426 status = locking (indesc, LK_RLCK, -1L);
430#else 427#else
431 status = flock (indesc, LOCK_EX); 428 status = flock (indesc, LOCK_EX);
432#endif 429#endif
433#endif
434#endif /* not MAIL_USE_LOCKF */ 430#endif /* not MAIL_USE_LOCKF */
435#endif /* MAIL_USE_SYSTEM_LOCK */ 431#endif /* MAIL_USE_SYSTEM_LOCK */
436 } 432 }
@@ -503,13 +499,7 @@ main (argc, argv)
503#ifdef MAIL_USE_SYSTEM_LOCK 499#ifdef MAIL_USE_SYSTEM_LOCK
504 if (! preserve_mail) 500 if (! preserve_mail)
505 { 501 {
506#if defined (STRIDE) || defined (XENIX)
507 /* Stride, xenix have file locking, but no ftruncate.
508 This mess will do. */
509 close (open (inname, O_CREAT | O_TRUNC | O_RDWR, 0666));
510#else
511 ftruncate (indesc, 0L); 502 ftruncate (indesc, 0L);
512#endif /* STRIDE or XENIX */
513 } 503 }
514#endif /* MAIL_USE_SYSTEM_LOCK */ 504#endif /* MAIL_USE_SYSTEM_LOCK */
515 505