From: Jean-Vincent Ficet Date: Tue, 10 Feb 2015 15:39:18 +0000 (+0100) Subject: rrd_daemon: Log strerror(errno) when rrd_mkdir_p() fails X-Git-Tag: v1.7.0~38^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F732%2Fhead;p=thirdparty%2Frrdtool-1.x.git 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. --- 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; }