summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/squark-auth-ip.c5
-rw-r--r--src/squark-auth-snmp.c4
-rw-r--r--src/squark-filter.c11
3 files changed, 15 insertions, 5 deletions
diff --git a/src/squark-auth-ip.c b/src/squark-auth-ip.c
index 677c008..20c7d35 100644
--- a/src/squark-auth-ip.c
+++ b/src/squark-auth-ip.c
@@ -13,6 +13,8 @@
#include <time.h>
#include <stdio.h>
#include <unistd.h>
+#include <errno.h>
+#include <string.h>
#include "config.h"
#include "blob.h"
@@ -65,7 +67,8 @@ static void handle_line(blob_t line)
}
b = blob_pushed(BLOB_BUF(reply), 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));
}
static void read_input(void)
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--;
diff --git a/src/squark-filter.c b/src/squark-filter.c
index 19c3583..9eed4a7 100644
--- a/src/squark-filter.c
+++ b/src/squark-filter.c
@@ -15,6 +15,7 @@
#include <ctype.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
#include <cmph.h>
@@ -330,7 +331,8 @@ static void send_ok(blob_t tag, blob_t categ, int override)
blob_push(&b, lf);
b = blob_pushed(BLOB_BUF(buffer), 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\n", strerror(errno));
}
static void send_redirect(blob_t redirect_page, blob_t tag, blob_t url, blob_t categ, blob_t username)
@@ -353,7 +355,8 @@ static void send_redirect(blob_t redirect_page, blob_t tag, blob_t url, blob_t c
blob_push(&b, lf);
b = blob_pushed(BLOB_BUF(buffer), 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\n", strerror(errno));
}
static void read_input(struct sqdb *db)
@@ -372,8 +375,10 @@ static void read_input(struct sqdb *db)
left = BLOB_BUF(buffer);
r = read(STDIN_FILENO, left.ptr, left.len);
- if (r < 0)
+ if (r < 0) {
+ report_error("Error occurred while reading from stdin: %s\n", strerror(errno));
return;
+ }
if (r == 0) {
running = 0;
return;