diff options
Diffstat (limited to 'src/blogc-runserver')
-rw-r--r-- | src/blogc-runserver/httpd.c | 18 | ||||
-rw-r--r-- | src/blogc-runserver/main.c | 8 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/blogc-runserver/httpd.c b/src/blogc-runserver/httpd.c index 66a7466..7d96c9b 100644 --- a/src/blogc-runserver/httpd.c +++ b/src/blogc-runserver/httpd.c @@ -212,7 +212,7 @@ br_httpd_run(const char *host, unsigned short port, const char *docroot, { if (port == 0) { fprintf(stderr, "Invalid port: 0\n"); - return 1; + return 3; } thread_data_t threads[max_threads]; @@ -222,7 +222,7 @@ br_httpd_run(const char *host, unsigned short port, const char *docroot, int server_socket = socket(AF_INET, SOCK_STREAM, 0); if (server_socket == -1) { fprintf(stderr, "Failed to open server socket: %s\n", strerror(errno)); - return 1; + return 3; } int rv = 0; @@ -230,7 +230,7 @@ br_httpd_run(const char *host, unsigned short port, const char *docroot, int value = 1; if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(int)) < 0) { fprintf(stderr, "Failed to set socket option: %s\n", strerror(errno)); - rv = 1; + rv = 3; goto cleanup; } @@ -240,7 +240,7 @@ br_httpd_run(const char *host, unsigned short port, const char *docroot, server_addr.sin_port = htons(port); if ((server_addr.sin_addr.s_addr = inet_addr(host)) == -1) { fprintf(stderr, "Invalid server listen address: %s\n", host); - rv = 1; + rv = 3; goto cleanup; } @@ -249,13 +249,13 @@ br_httpd_run(const char *host, unsigned short port, const char *docroot, { fprintf(stderr, "Failed to bind to server socket (%s:%d): %s\n", host, port, strerror(errno)); - rv = 1; + rv = 3; goto cleanup; } if (listen(server_socket, LISTEN_BACKLOG) == -1) { fprintf(stderr, "Failed to listen to server socket: %s\n", strerror(errno)); - rv = 1; + rv = 3; goto cleanup; } @@ -275,7 +275,7 @@ br_httpd_run(const char *host, unsigned short port, const char *docroot, (struct sockaddr *) &client_addr, &len); if (client_socket == -1) { fprintf(stderr, "Failed to accept connection: %s\n", strerror(errno)); - rv = 1; + rv = 3; goto cleanup; } @@ -288,14 +288,14 @@ br_httpd_run(const char *host, unsigned short port, const char *docroot, if (threads[current_thread].initialized) { if (pthread_join(threads[current_thread].thread, NULL) != 0) { fprintf(stderr, "Failed to join thread\n"); - rv = 1; + rv = 3; goto cleanup; } } if (pthread_create(&(threads[current_thread].thread), NULL, handle_request, arg) != 0) { fprintf(stderr, "Failed to create thread\n"); - rv = 1; + rv = 3; goto cleanup; } diff --git a/src/blogc-runserver/main.c b/src/blogc-runserver/main.c index 0b8d0fe..7f83f42 100644 --- a/src/blogc-runserver/main.c +++ b/src/blogc-runserver/main.c @@ -98,7 +98,7 @@ main(int argc, char **argv) print_usage(); fprintf(stderr, "blogc-runserver: error: invalid " "argument: -%c\n", argv[i][1]); - rv = 2; + rv = 3; goto cleanup; } } @@ -107,7 +107,7 @@ main(int argc, char **argv) print_usage(); fprintf(stderr, "blogc-runserver: error: only one positional " "argument allowed\n"); - rv = 2; + rv = 3; goto cleanup; } args++; @@ -119,7 +119,7 @@ main(int argc, char **argv) print_usage(); fprintf(stderr, "blogc-runserver: error: document root directory " "required\n"); - rv = 2; + rv = 3; goto cleanup; } @@ -127,7 +127,7 @@ main(int argc, char **argv) print_usage(); fprintf(stderr, "blogc-runserver: error: invalid value for -m. " "Must be integer > 0 and <= 1000\n"); - rv = 2; + rv = 3; goto cleanup; } |