aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman1989-05-14 22:52:53 +0000
committerRichard M. Stallman1989-05-14 22:52:53 +0000
commit4293ba7fe694f249ab2438a8326c313af94c0a32 (patch)
tree9a3ed204c762f05e3d4ea402f53428f4a3fa24ba /lib-src
parentf2cc4248dd72eadba31c4e65bee8463b39bc642d (diff)
downloademacs-4293ba7fe694f249ab2438a8326c313af94c0a32.tar.gz
emacs-4293ba7fe694f249ab2438a8326c313af94c0a32.zip
*** empty log message ***
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/movemail.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 32e4039d519..961d2eaa1ac 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -52,6 +52,10 @@ copyright notice and this notice must be preserved on all copies. */
52#include <sys/locking.h> 52#include <sys/locking.h>
53#endif 53#endif
54 54
55#ifdef MAIL_USE_MMDF
56extern int lk_open (), lk_close ();
57#endif
58
55/* Cancel substitutions made by config.h for Emacs. */ 59/* Cancel substitutions made by config.h for Emacs. */
56#undef open 60#undef open
57#undef read 61#undef read
@@ -90,6 +94,10 @@ main (argc, argv)
90 inname = argv[1]; 94 inname = argv[1];
91 outname = argv[2]; 95 outname = argv[2];
92 96
97#ifdef MAIL_USE_MMDF
98 mmdf_init (argv[0]);
99#endif
100
93 /* Check access to input and output file. */ 101 /* Check access to input and output file. */
94 if (access (inname, R_OK | W_OK) != 0) 102 if (access (inname, R_OK | W_OK) != 0)
95 pfatal_with_name (inname); 103 pfatal_with_name (inname);
@@ -124,6 +132,7 @@ main (argc, argv)
124 setuid (getuid()); 132 setuid (getuid());
125#endif /* MAIL_USE_POP */ 133#endif /* MAIL_USE_POP */
126 134
135#ifndef MAIL_USE_MMDF
127#ifndef MAIL_USE_FLOCK 136#ifndef MAIL_USE_FLOCK
128 /* Use a lock file named /usr/spool/mail/$USER.lock: 137 /* Use a lock file named /usr/spool/mail/$USER.lock:
129 If it exists, the mail file is locked. */ 138 If it exists, the mail file is locked. */
@@ -169,6 +178,10 @@ main (argc, argv)
169#else /* if not MAIL_USE_FLOCK */ 178#else /* if not MAIL_USE_FLOCK */
170 indesc = open (inname, O_RDONLY); 179 indesc = open (inname, O_RDONLY);
171#endif /* not MAIL_USE_FLOCK */ 180#endif /* not MAIL_USE_FLOCK */
181#else /* MAIL_USE_MMDF */
182 indesc = lk_open (inname, O_RDONLY, 0, 0, 10);
183#endif /* MAIL_USE_MMDF */
184
172 if (indesc < 0) 185 if (indesc < 0)
173 pfatal_with_name (inname); 186 pfatal_with_name (inname);
174 187
@@ -225,14 +238,21 @@ main (argc, argv)
225 (void) ftruncate (indesc, 0L); 238 (void) ftruncate (indesc, 0L);
226#endif /* STRIDE or XENIX */ 239#endif /* STRIDE or XENIX */
227#endif /* MAIL_USE_FLOCK */ 240#endif /* MAIL_USE_FLOCK */
241
242#ifdef MAIL_USE_MMDF
243 lk_close (indesc, 0, 0, 0);
244#else
228 close (indesc); 245 close (indesc);
246#endif
229 247
230#ifndef MAIL_USE_FLOCK 248#ifndef MAIL_USE_FLOCK
231 /* Delete the input file; if we can't, at least get rid of its contents. */ 249 /* Delete the input file; if we can't, at least get rid of its contents. */
232 if (unlink (inname) < 0) 250 if (unlink (inname) < 0)
233 if (errno != ENOENT) 251 if (errno != ENOENT)
234 creat (inname, 0666); 252 creat (inname, 0666);
235 (void) unlink (lockname); 253#ifndef MAIL_USE_MMDF
254 unlink (lockname);
255#endif /* not MAIL_USE_MMDF */
236#endif /* not MAIL_USE_FLOCK */ 256#endif /* not MAIL_USE_FLOCK */
237 exit (0); 257 exit (0);
238} 258}