Blame vnstat-run-vnstat.diff
|
|
973b8d3 |
--- a/src/vnstatd.c 2011-06-01 00:29:51.000000000 +0200
|
|
|
973b8d3 |
+++ b/src/vnstatd.c 2011-12-22 22:23:22.512967108 +0100
|
|
|
973b8d3 |
@@ -482,10 +482,18 @@
|
|
|
973b8d3 |
/* lock / pid file */
|
|
|
973b8d3 |
pidfile = open(cfg.pidfile, O_RDWR|O_CREAT, 0644);
|
|
|
973b8d3 |
if (pidfile<0) {
|
|
|
973b8d3 |
- perror("pidfile");
|
|
|
973b8d3 |
- snprintf(errorstring, 512, "pidfile failed, exiting.");
|
|
|
973b8d3 |
- printe(PT_Error);
|
|
|
973b8d3 |
- exit(EXIT_FAILURE); /* can't open */
|
|
|
973b8d3 |
+ /* for Fedora's move to systemd and /run check
|
|
|
973b8d3 |
+ * for /run/vnstat/vnstat.pid, so that it needs no changes
|
|
|
973b8d3 |
+ * to the config file */
|
|
|
973b8d3 |
+ pidfile = open("/run/vnstat/vnstat.pid", O_RDWR|O_CREAT, 0644);
|
|
|
973b8d3 |
+ if (pidfile<0) {
|
|
|
973b8d3 |
+ perror("pidfile");
|
|
|
973b8d3 |
+ snprintf(errorstring, 512, "pidfile failed, exiting.");
|
|
|
973b8d3 |
+ printe(PT_Error);
|
|
|
973b8d3 |
+ exit(EXIT_FAILURE); /* can't open */
|
|
|
973b8d3 |
+ } else {
|
|
|
973b8d3 |
+ strncpy(cfg.pidfile, "/run/vnstat/vnstat.pid", 512);
|
|
|
973b8d3 |
+ }
|
|
|
973b8d3 |
}
|
|
|
973b8d3 |
if (lockf(pidfile,F_TLOCK,0)<0) {
|
|
|
973b8d3 |
perror("pidfile lock");
|