summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-12-09 02:39:37 +0000
committerStef Walter <stef@memberwebs.com>2006-12-09 02:39:37 +0000
commit87e34f02c04da9dc2d254bf9f4e543ac014d712f (patch)
tree6c299cb7f5464c588d9ce03ed121a1c84985faf6
parent2ba8cd814f0de8bc8cb18d5add9fa35c88fb9330 (diff)
- Remove pid file when exiting [benj]
-rw-r--r--ChangeLog3
-rw-r--r--daemon/rrdbotd.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6732d4d..74b4741 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@
- Added SNMP version 2c support for rrdbot-get [Stoned Elipot]
- Fixed asynchronous resolving on FreeBSD
- Fix bug where rrdbot-create ignored '-c' argument [benj]
-
+ - Remove pid file when exiting [benj]
+
0.4
- Reduced memory usage of SNMP requests
- Added asynchronous DNS resolver
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;
}