summaryrefslogtreecommitdiff
path: root/src/user/app/httpd/httpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/httpd/httpd.c')
-rw-r--r--src/user/app/httpd/httpd.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/user/app/httpd/httpd.c b/src/user/app/httpd/httpd.c
index 2ffc2ba..02f9e6b 100644
--- a/src/user/app/httpd/httpd.c
+++ b/src/user/app/httpd/httpd.c
@@ -2,12 +2,11 @@
* easily DoSable (like the rest of the network stack), vulnerable to path traversal, etc */
#include <camellia/flags.h>
#include <camellia/syscalls.h>
+#include <err.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#define eprintf(fmt, ...) fprintf(stderr, "httpd: "fmt"\n" __VA_OPT__(,) __VA_ARGS__)
-
static void handle(FILE *c) {
char buf[2048];
fgets(buf, sizeof buf, c);
@@ -69,10 +68,8 @@ int main(int argc, char **argv) {
handle_t conn;
for (;;) {
conn = _syscall_open(path, strlen(path), OPEN_RW);
- if (conn < 0) {
- eprintf("open('%s') failed, %d", path, conn);
- return 1;
- }
+ if (conn < 0)
+ errx(1, "open('%s') failed, errno %d", path, -conn);
FILE *f = fdopen(conn, "a+");
handle(f);
fclose(f);