diff options
Diffstat (limited to 'daemon/rrdbotd.c')
-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; } |