From: Manoj Kumar Date: Wed, 28 Sep 2016 16:29:12 +0000 (+0530) Subject: Improve messages for rrdcached daemon failed due to PID Exist (#743) X-Git-Tag: v1.7.0~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c871789f4ed0513a2f4eeb561e1657d041a9fd3e;p=thirdparty%2Frrdtool-1.x.git Improve messages for rrdcached daemon failed due to PID Exist (#743) * Improve messages for rrdcached daemon failed due to PID Exist New messages added in order to get clarity about the nature of problem * Review Comment incorporated regarding indentation of error messages --- diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index db548e78..0cb86dca 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -524,16 +524,21 @@ static int check_pidfile(void) char pid_str[16]; pid_fd = open_pidfile("open", O_RDWR); - if (pid_fd < 0) + if (pid_fd < 0){ + fprintf(stderr,"FATAL: Fail to create/open PID file \n"); return pid_fd; + } if (read(pid_fd, pid_str, sizeof(pid_str)) <= 0) { + fprintf(stderr,"FATAL: Empty PID file exist\n"); close(pid_fd); return -1; } pid = atoi(pid_str); if (pid <= 0) { + fprintf(stderr,"FATAL: PID file is corrupted\n"); + close(pid_fd); return -1; }