]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
rrd_daemon: Log strerror(errno) when rrd_mkdir_p() fails 732/head
authorJean-Vincent Ficet <jean-vincent.ficet@bull.net>
Tue, 10 Feb 2015 15:39:18 +0000 (16:39 +0100)
committerMarek Schimara <Marek.Schimara@bull.net>
Wed, 24 Aug 2016 08:03:29 +0000 (10:03 +0200)
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

index 8cde3b451b961f141e865f2c047c93fc95081ff3..4ceddfcc6107cbfd723701212c5c0bd71a1bc3c1 100644 (file)
@@ -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;
     }