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 /fetchmail.c | |
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
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 15 |
1 files changed, 12 insertions, 3 deletions
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; } } |