comparison lib-src/movemail.c @ 571:3dfecf91a09b

*** empty log message ***
author David J. MacKenzie <djm@gnu.org>
date Mon, 09 Mar 1992 17:40:11 +0000
parents 4eaef1578a15
children c8860f81ccf7
comparison
equal deleted inserted replaced
570:c5bfe6e87d93 571:3dfecf91a09b
78 #undef open 78 #undef open
79 #undef read 79 #undef read
80 #undef write 80 #undef write
81 #undef close 81 #undef close
82 82
83 char *malloc ();
83 char *concat (); 84 char *concat ();
85 char *xmalloc ();
86 #ifndef errno
84 extern int errno; 87 extern int errno;
88 #endif
85 89
86 /* Nonzero means this is name of a lock file to delete on fatal error. */ 90 /* Nonzero means this is name of a lock file to delete on fatal error. */
87 char *delete_lockname; 91 char *delete_lockname;
88 92
89 main (argc, argv) 93 main (argc, argv)
282 close (indesc); 286 close (indesc);
283 #endif 287 #endif
284 288
285 #ifndef MAIL_USE_FLOCK 289 #ifndef MAIL_USE_FLOCK
286 /* Delete the input file; if we can't, at least get rid of its contents. */ 290 /* Delete the input file; if we can't, at least get rid of its contents. */
287 if (unlink (inname) < 0) 291 #ifdef MAIL_UNLINK_SPOOL
288 if (errno != ENOENT) 292 /* This is generally bad to do, because it destroys the permissions
289 creat (inname, 0666); 293 that were set on the file. Better to just empty the file. */
294 if (unlink (inname) < 0 && errno != ENOENT)
295 #endif /* MAIL_UNLINK_SPOOL */
296 creat (inname, 0600);
290 #ifndef MAIL_USE_MMDF 297 #ifndef MAIL_USE_MMDF
291 unlink (lockname); 298 unlink (lockname);
292 #endif /* not MAIL_USE_MMDF */ 299 #endif /* not MAIL_USE_MMDF */
293 #endif /* not MAIL_USE_FLOCK */ 300 #endif /* not MAIL_USE_FLOCK */
294 exit (0); 301 exit (0);
362 return result; 369 return result;
363 } 370 }
364 371
365 /* Like malloc but get fatal error if memory is exhausted. */ 372 /* Like malloc but get fatal error if memory is exhausted. */
366 373
367 int 374 char *
368 xmalloc (size) 375 xmalloc (size)
369 int size; 376 unsigned size;
370 { 377 {
371 int result = malloc (size); 378 char *result = malloc (size);
372 if (!result) 379 if (!result)
373 fatal ("virtual memory exhausted", 0); 380 fatal ("virtual memory exhausted", 0);
374 return result; 381 return result;
375 } 382 }
376 383