diff options
author | Stef Walter <stef@memberwebs.com> | 2006-12-09 02:39:37 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2006-12-09 02:39:37 +0000 |
commit | 87e34f02c04da9dc2d254bf9f4e543ac014d712f (patch) | |
tree | 6c299cb7f5464c588d9ce03ed121a1c84985faf6 /daemon | |
parent | 2ba8cd814f0de8bc8cb18d5add9fa35c88fb9330 (diff) |
- Remove pid file when exiting [benj]
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/rrdbotd.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/daemon/rrdbotd.c b/daemon/rrdbotd.c index 9e81350..c74648d 100644 --- a/daemon/rrdbotd.c +++ b/daemon/rrdbotd.c @@ -205,6 +205,16 @@ writepid(const char* pidfile) fclose(f); } +static void +removepid(const char* pidfile) +{ + if(unlink(pidfile) < 0) + { + if(errno != ENOENT) + rb_message(LOG_WARNING, "couldn't remove pid file: %s", pidfile); + } +} + int main(int argc, char* argv[]) { @@ -353,5 +363,8 @@ main(int argc, char* argv[]) async_resolver_uninit(); server_uninit(); + if(pidfile != NULL) + removepid(pidfile); + return 0; } |