aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-runserver/httpd.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-03-28 19:51:32 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-03-28 19:51:32 +0100
commita7d888e158104ee7993921687457dc3b4ddd6c4b (patch)
tree8596b5e0bb7d34ef29ea4c7e6730390dd06faf80 /src/blogc-runserver/httpd.c
parent09139645e866b745c9f8797659f12c90af867015 (diff)
downloadblogc-a7d888e158104ee7993921687457dc3b4ddd6c4b.tar.gz
blogc-a7d888e158104ee7993921687457dc3b4ddd6c4b.tar.bz2
blogc-a7d888e158104ee7993921687457dc3b4ddd6c4b.zip
runserver: exit 1 on error
Diffstat (limited to 'src/blogc-runserver/httpd.c')
-rw-r--r--src/blogc-runserver/httpd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/blogc-runserver/httpd.c b/src/blogc-runserver/httpd.c
index 79c5ec5..513c4b0 100644
--- a/src/blogc-runserver/httpd.c
+++ b/src/blogc-runserver/httpd.c
@@ -271,7 +271,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
if (0 != (err = getaddrinfo(host, port, &hints, &result))) {
fprintf(stderr, "Failed to get host:port info: %s\n",
gai_strerror(err));
- return 3;
+ return 1;
}
thread_data_t threads[max_threads];
@@ -295,7 +295,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
if (rp->ai_next == NULL) {
fprintf(stderr, "Failed to open server socket (%s:%d): %s\n",
final_host, final_port, strerror(errno));
- rv = 3;
+ rv = 1;
goto cleanup0;
}
continue;
@@ -307,7 +307,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
if (rp->ai_next == NULL) {
fprintf(stderr, "Failed to set socket option (%s:%d): %s\n",
final_host, final_port, strerror(errno));
- rv = 3;
+ rv = 1;
goto cleanup;
}
close(server_socket);
@@ -321,7 +321,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
if (rp->ai_next == NULL) {
fprintf(stderr, "Failed to bind to server socket (%s:%d): %s\n",
final_host, final_port, strerror(errno));
- rv = 3;
+ rv = 1;
goto cleanup;
}
}
@@ -332,7 +332,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
if (-1 == listen(server_socket, LISTEN_BACKLOG)) {
fprintf(stderr, "Failed to listen to server socket (%s:%d): %s\n",
final_host, final_port, strerror(errno));
- rv = 3;
+ rv = 1;
goto cleanup;
}
@@ -369,7 +369,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
int client_socket = accept(server_socket, client_addr, &addrlen);
if (client_socket == -1) {
fprintf(stderr, "Failed to accept connection: %s\n", strerror(errno));
- rv = 3;
+ rv = 1;
goto cleanup;
}
@@ -384,7 +384,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
fprintf(stderr, "Failed to join thread\n");
free(arg->ip);
free(arg);
- rv = 3;
+ rv = 1;
goto cleanup;
}
}
@@ -393,7 +393,7 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
handle_request, arg) != 0)
{
fprintf(stderr, "Failed to create thread\n");
- rv = 3;
+ rv = 1;
goto cleanup;
}