summaryrefslogtreecommitdiffstats
path: root/src/squark-filter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/squark-filter.c')
-rw-r--r--src/squark-filter.c11
1 files changed, 8 insertions, 3 deletions
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;