From a79526e518a9b85fbbd74fa0694055767651ed53 Mon Sep 17 00:00:00 2001 From: Jean-Vincent Ficet Date: Tue, 10 Feb 2015 16:39:18 +0100 Subject: [PATCH] rrd_daemon: Log strerror(errno) when rrd_mkdir_p() fails Log strerror(errno) when rrd_mkdir_p() fails in order to know what went wrong from a client application perspective. In this particular case, rrd_mkdir_p failed due to the lack of inodes. Sending a message with 'No Space left on device' allowed the application to limit the logs in the code in charge of handling the RRDTOOL_FILESYSTEM_FULL error, rather than flooding the logs with all the failed queries. --- src/rrd_daemon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c index 8cde3b45..4ceddfcc 100644 --- a/src/rrd_daemon.c +++ b/src/rrd_daemon.c @@ -2293,7 +2293,8 @@ static int handle_request_create (HANDLER_PROTO) /* {{{ */ goto done; } if (rrd_mkdir_p(dir, 0755) != 0) { - rc = send_response(sock, RESP_ERR, "Cannot create: %s\n", dir); + rc = send_response(sock, RESP_ERR, "Cannot create %s: %s\n", + dir, strerror(errno)); pthread_mutex_unlock(&rrdfilecreate_lock); goto done; } -- 2.47.2