diff options
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fetchmail.c b/fetchmail.c index f6cf3259..17fcca56 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -59,6 +59,12 @@ static int lastsig; RETSIGTYPE donothing(sig) int sig; {signal(sig, donothing); lastsig = sig;} +static void unlockit() +/* must-do actions for exit (but we can't count on being able to do malloc) */ +{ + unlink(lockfile); +} + int main (argc,argv) int argc; char **argv; @@ -284,6 +290,7 @@ char **argv; if (poll_interval) fprintf(lockfp," %d", poll_interval); fclose(lockfp); + atexit(unlockit); } /* @@ -571,7 +578,6 @@ void termhook(int sig) if (!check_only) write_saved_lists(querylist, idfile); - unlink(lockfile); exit(popstatus); } |