summaryrefslogtreecommitdiff
path: root/lib-src/movemail.c
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-08-19 16:48:59 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-08-19 16:48:59 -0700
commit07fcbb558d797272b9f43547da60beda485873a3 (patch)
tree77d5da14e9f9d9d8b1d877c70c01296fd3893796 /lib-src/movemail.c
parentc9bdeff3e45a7ac84a74a81bb048046f82dddc91 (diff)
parentfb81c8c3adf8633f2f617c82f6019aef630860c7 (diff)
downloademacs-07fcbb558d797272b9f43547da60beda485873a3.tar.gz
Merge remote-tracking branch 'origin/master' into athena/unstable
Diffstat (limited to 'lib-src/movemail.c')
-rw-r--r--lib-src/movemail.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index cfdebccb8d0..e683da179df 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -270,6 +270,7 @@ main (int argc, char **argv)
You might also wish to verify that your system is one which
uses lock files for this purpose. Some systems use other methods. */
+ bool lockname_unlinked = false;
inname_len = strlen (inname);
lockname = xmalloc (inname_len + sizeof ".lock");
strcpy (lockname, inname);
@@ -312,15 +313,10 @@ main (int argc, char **argv)
Five minutes should be good enough to cope with crashes
and wedgitude, and long enough to avoid being fooled
by time differences between machines. */
- if (stat (lockname, &st) >= 0)
- {
- time_t now = time (0);
- if (st.st_ctime < now - 300)
- {
- unlink (lockname);
- lockname = 0;
- }
- }
+ if (!lockname_unlinked
+ && stat (lockname, &st) == 0
+ && st.st_ctime < time (0) - 300)
+ lockname_unlinked = unlink (lockname) == 0 || errno == ENOENT;
}
delete_lockname = lockname;