diff options
Diffstat (limited to 'networking/httpd.c')
-rw-r--r-- | networking/httpd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index b82e9f995..97b04fb03 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -802,7 +802,6 @@ static int openServer(void) | |||
802 | { | 802 | { |
803 | struct sockaddr_in lsocket; | 803 | struct sockaddr_in lsocket; |
804 | int fd; | 804 | int fd; |
805 | int on = 1; | ||
806 | 805 | ||
807 | /* create the socket right now */ | 806 | /* create the socket right now */ |
808 | /* inet_addr() returns a value that is already in network order */ | 807 | /* inet_addr() returns a value that is already in network order */ |
@@ -814,9 +813,13 @@ static int openServer(void) | |||
814 | /* tell the OS it's OK to reuse a previous address even though */ | 813 | /* tell the OS it's OK to reuse a previous address even though */ |
815 | /* it may still be in a close down state. Allows bind to succeed. */ | 814 | /* it may still be in a close down state. Allows bind to succeed. */ |
816 | #ifdef SO_REUSEPORT | 815 | #ifdef SO_REUSEPORT |
817 | setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (void *)&on, sizeof(on)); | 816 | { |
817 | static const int on = 1; | ||
818 | setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, | ||
819 | (void *)&on, sizeof(on)); | ||
820 | } | ||
818 | #else | 821 | #else |
819 | setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); | 822 | setsockopt_reuseaddr(fd); |
820 | #endif | 823 | #endif |
821 | xbind(fd, (struct sockaddr *)&lsocket, sizeof(lsocket)); | 824 | xbind(fd, (struct sockaddr *)&lsocket, sizeof(lsocket)); |
822 | xlisten(fd, 9); | 825 | xlisten(fd, 9); |