summaryrefslogtreecommitdiff
path: root/networking/httpd.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-11-22 23:22:06 +0000
committerDenis Vlasenko2006-11-22 23:22:06 +0000
commit48237b0c88343154d58854020c3a9c8b07c61b10 (patch)
treeb36bc84f22dd797b45c8d665e50e2f6c690e1370 /networking/httpd.c
parentb40bdb383a6b7a7f0fd36d0b1cc24deb42cd5f0d (diff)
downloadbusybox-48237b0c88343154d58854020c3a9c8b07c61b10.zip
busybox-48237b0c88343154d58854020c3a9c8b07c61b10.tar.gz
introduce setsockopt_reuseaddr(int fd), setsockopt_broadcast(int fd),
use them where appropriate. 200 bytes saved
Diffstat (limited to 'networking/httpd.c')
-rw-r--r--networking/httpd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index b82e9f9..97b04fb 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -802,7 +802,6 @@ static int openServer(void)
{
struct sockaddr_in lsocket;
int fd;
- int on = 1;
/* create the socket right now */
/* inet_addr() returns a value that is already in network order */
@@ -814,9 +813,13 @@ static int openServer(void)
/* tell the OS it's OK to reuse a previous address even though */
/* it may still be in a close down state. Allows bind to succeed. */
#ifdef SO_REUSEPORT
- setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (void *)&on, sizeof(on));
+ {
+ static const int on = 1;
+ setsockopt(fd, SOL_SOCKET, SO_REUSEPORT,
+ (void *)&on, sizeof(on));
+ }
#else
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on));
+ setsockopt_reuseaddr(fd);
#endif
xbind(fd, (struct sockaddr *)&lsocket, sizeof(lsocket));
xlisten(fd, 9);