summaryrefslogtreecommitdiffstats
path: root/src/squark-auth-snmp.c
diff options
context:
space:
mode:
authorAlex Dowad <alexinbeijing@gmail.com>2014-04-07 12:02:29 +0200
committerTimo Teräs <timo.teras@iki.fi>2014-04-25 10:17:03 +0300
commit827c2c3823ba1923d3fb01e191997f6b9edd21a5 (patch)
treed31b88c51a37de478973dc7981588d0c916ec20f /src/squark-auth-snmp.c
parent751bbc05d4dd72bdbe7e57f6724de865cd7c0bd9 (diff)
downloadsquark-827c2c3823ba1923d3fb01e191997f6b9edd21a5.tar.bz2
squark-827c2c3823ba1923d3fb01e191997f6b9edd21a5.tar.xz
all: report errors if calls to write() fail
This also quiets compiler warnings for "ignored return values".
Diffstat (limited to 'src/squark-auth-snmp.c')
-rw-r--r--src/squark-auth-snmp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/squark-auth-snmp.c b/src/squark-auth-snmp.c
index 05832d4..e9fabbe 100644
--- a/src/squark-auth-snmp.c
+++ b/src/squark-auth-snmp.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
@@ -620,7 +621,8 @@ static void auth_completed(struct auth_context *auth)
report_private_message(REPORT_WARNING, "%s failed: %s", addr_print(&auth->addr), auth->status_msg);
}
b = blob_pushed(BLOB_BUF(tmp), b);
- write(STDOUT_FILENO, b.ptr, b.len);
+ if(write(STDOUT_FILENO, b.ptr, b.len) < 0)
+ report_error("Error occurred while writing to stdout: %s", strerror(errno));
auth_free(auth);
num_queries--;