diff options
author | Max Christian Pohle | 2021-11-23 19:19:07 +0100 |
---|---|---|
committer | Max Christian Pohle | 2021-11-23 19:21:08 +0100 |
commit | dd41b7c512c6f2bde11dd9378a49a17b80d7df92 (patch) | |
tree | f9465db51d43603adc602c63f9cd80395eaff670 /main.c | |
parent | 7991c931a0d7a6888ca151869137b7f9ab78852c (diff) | |
download | ohmycgi-dd41b7c512c6f2bde11dd9378a49a17b80d7df92.tar.bz2 ohmycgi-dd41b7c512c6f2bde11dd9378a49a17b80d7df92.zip |
simplified further for initial compatibility with FreeBSD
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -254,7 +254,7 @@ static int serve(int server_fd) | |||
254 | } | 254 | } |
255 | 255 | ||
256 | int main(const int argc, char const * argv[]) { | 256 | int main(const int argc, char const * argv[]) { |
257 | int server_fd = -1, opt = 1; | 257 | int server_fd = -1; |
258 | 258 | ||
259 | int port = atoi(argc > 1 ? argv[1] : "8080"); | 259 | int port = atoi(argc > 1 ? argv[1] : "8080"); |
260 | 0 == port ? port = 8080 : port; | 260 | 0 == port ? port = 8080 : port; |
@@ -269,8 +269,6 @@ int main(const int argc, char const * argv[]) { | |||
269 | // I <3 C | 269 | // I <3 C |
270 | 0 == (server_fd = socket(AF_INET, SOCK_STREAM, 0)) | 270 | 0 == (server_fd = socket(AF_INET, SOCK_STREAM, 0)) |
271 | ? err(errno, NULL) | 271 | ? err(errno, NULL) |
272 | : setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)) | ||
273 | ? err(errno, "setsockopt failed on socket with fileno %d", server_fd) | ||
274 | : bind(server_fd, (struct sockaddr*) &address, sizeof(address)) | 272 | : bind(server_fd, (struct sockaddr*) &address, sizeof(address)) |
275 | ? err(errno, NULL) | 273 | ? err(errno, NULL) |
276 | : listen(server_fd, SOMAXCONN) | 274 | : listen(server_fd, SOMAXCONN) |