From dd41b7c512c6f2bde11dd9378a49a17b80d7df92 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Tue, 23 Nov 2021 19:19:07 +0100 Subject: simplified further for initial compatibility with FreeBSD --- Makefile | 7 ++++++- main.c | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b352ab3..e9b5f00 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,11 @@ CFLAGS := ${cflags.${BUILD}} LIBS := -lcups +CFLAGS += -L/usr/local/lib +CFLAGS += -I/usr/local/include + +FILES := cgi.c + test: main ./main @@ -15,5 +20,5 @@ clean: rm -f ./main %: - $(CC) $(CFLAGS) -o $@ cgi.c main.c $(LIBS) + $(CC) $(CFLAGS) -o $@ $(FILES) main.c $(LIBS) diff --git a/main.c b/main.c index 8f1d3ef..c1a7c30 100644 --- a/main.c +++ b/main.c @@ -254,7 +254,7 @@ static int serve(int server_fd) } int main(const int argc, char const * argv[]) { - int server_fd = -1, opt = 1; + int server_fd = -1; int port = atoi(argc > 1 ? argv[1] : "8080"); 0 == port ? port = 8080 : port; @@ -269,8 +269,6 @@ int main(const int argc, char const * argv[]) { // I <3 C 0 == (server_fd = socket(AF_INET, SOCK_STREAM, 0)) ? err(errno, NULL) - : setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)) - ? err(errno, "setsockopt failed on socket with fileno %d", server_fd) : bind(server_fd, (struct sockaddr*) &address, sizeof(address)) ? err(errno, NULL) : listen(server_fd, SOMAXCONN) -- cgit v1.2.3