diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2005-10-30 19:39:56 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2005-10-30 19:39:56 +0000 |
commit | d7d53f439806e684c893cbe977a121b81cc8ad28 (patch) | |
tree | f4ee2df2548bf6de52601a759e8dc5683628755f | |
parent | 3f9c96674b47120d42e48b17d8de9939fe70ed88 (diff) | |
download | fetchmail-d7d53f439806e684c893cbe977a121b81cc8ad28.tar.gz fetchmail-d7d53f439806e684c893cbe977a121b81cc8ad28.tar.bz2 fetchmail-d7d53f439806e684c893cbe977a121b81cc8ad28.zip |
Do not break some other process's lockfile in "-q" mode, but wait for
the other process's exit.
svn path=/trunk/; revision=4377
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | fetchmail.c | 15 |
2 files changed, 14 insertions, 3 deletions
@@ -252,6 +252,8 @@ fetchmail 6.3.0 (not yet released officially): * Exit with error if the lock file cannot be read. Matthias Andree * Exit with error if the lock file cannot be created exclusively, this got broken in a 6.2.6-pre, 6.2.5.2 and older were fine. Matthias Andree +* Do not break some other process's lockfile in "-q" mode, but wait for the + other process's exit. Matthias Andree # INTERNAL CHANGES * Switched to automake. Matthias Andree. diff --git a/fetchmail.c b/fetchmail.c index 3e6d1408..93c5cd8b 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -402,14 +402,23 @@ int main(int argc, char **argv) } else { + int maxwait; + if (outlevel > O_SILENT) fprintf(stderr,GT_("fetchmail: %s fetchmail at %d killed.\n"), bkgd ? GT_("background") : GT_("foreground"), pid); - fm_lock_release(); + /* We used to nuke the other process's lock here, with + * fm_lock_release(), which is broken. The other process + * needs to clear its lock by itself. */ if (quitonly) exit(0); - else - pid = 0; + + /* wait for other process to exit */ + maxwait = 10; /* seconds */ + while (kill(pid, 0) == 0 && --maxwait >= 0) { + sleep(1); + } + pid = 0; } } |