From 320a9c59517bf299abb4f33442c9900e59242902 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Wed, 15 Jun 2011 22:11:29 +0200 Subject: log unixsock errors instead of printing them These errors got concatenated in front of the image, which resulted in an invalid image. --- inc/collectd.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php index 18f56c8..e5a7df4 100644 --- a/inc/collectd.inc.php +++ b/inc/collectd.inc.php @@ -204,15 +204,15 @@ function collectd_flush($identifier) { $r = fwrite($socket, $cmd, strlen($cmd)); if ($r === false || $r != strlen($cmd)) { - printf('ERROR: Failed to write full command to unix-socket: %d out of %d written', - $r === false ? -1 : $r, strlen($cmd)); + error_log(sprintf('ERROR: Failed to write full command to unix-socket: %d out of %d written', + $r === false ? -1 : $r, strlen($cmd))); return FALSE; } $resp = fgets($socket); if ($resp === false) { - printf('ERROR: Failed to read response from collectd for command: %s', - trim($cmd)); + error_log(sprintf('ERROR: Failed to read response from collectd for command: %s', + trim($cmd))); return FALSE; } @@ -224,8 +224,8 @@ function collectd_flush($identifier) { return TRUE; } else { - printf('ERROR: Failed to open unix-socket to collectd: %d: %s', - $u_errno, $u_errmsg); + error_log(sprintf('ERROR: Failed to open unix-socket to collectd: %d: %s', + $u_errno, $u_errmsg)); return FALSE; } } -- cgit v1.1