From c871789f4ed0513a2f4eeb561e1657d041a9fd3e Mon Sep 17 00:00:00 2001 From: Manoj Kumar Date: Wed, 28 Sep 2016 21:59:12 +0530 Subject: [PATCH] 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 --- src/rrd_daemon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- 2.47.2