X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_daemon.c;h=d8f140e7f875b8ef04621cdbf0cacbab5e19da45;hp=53904a331357b2d0a745bb625249191cb26f28c4;hb=3a5dd3888f1a7f8b3b9cec4527040bad143a6d7b;hpb=4445ea8dfeb4f30fd181c922141303fa49e01c5a diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 53904a3..d8f140e 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -379,7 +379,13 @@ static int check_pidfile(void) } lseek(pid_fd, 0, SEEK_SET); - ftruncate(pid_fd, 0); + if (ftruncate(pid_fd, 0) == -1) + { + fprintf(stderr, + "FATAL: Faild to truncate stale PID file. (pid %d)\n", pid); + close(pid_fd); + return -1; + } fprintf(stderr, "rrdcached: removed stale PID file (no rrdcached on pid %d)\n" @@ -650,6 +656,7 @@ static void *free_cache_item(cache_item_t *ci) /* {{{ */ /* in case anyone is waiting */ pthread_cond_broadcast(&ci->flushed); + pthread_cond_destroy(&ci->flushed); free (ci); @@ -2446,8 +2453,9 @@ static int daemonize (void) /* {{{ */ close (0); open ("/dev/null", O_RDWR); - dup (0); - dup (0); + if (dup(0) == -1 || dup(0) == -1){ + RRDD_LOG (LOG_ERR, "faild to run dup.\n"); + } } /* if (!stay_foreground) */ /* Change into the /tmp directory. */