summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-tcpserver4-socketbinder.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-12-09 18:30:22 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-12-09 18:30:22 +0000
commitb6de172b3545a73f6f31500ee9c4d51898fbe2bc (patch)
tree8ecf4a5b3f1c5e2711057b468c017e8ebfa621b7 /src/conn-tools/s6-tcpserver4-socketbinder.c
parentf7e676abdc799fcee5138807447b5e91ab05508f (diff)
downloads6-networking-b6de172b3545a73f6f31500ee9c4d51898fbe2bc.tar.xz
Get rid of webipc.h
Diffstat (limited to 'src/conn-tools/s6-tcpserver4-socketbinder.c')
-rw-r--r--src/conn-tools/s6-tcpserver4-socketbinder.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/conn-tools/s6-tcpserver4-socketbinder.c b/src/conn-tools/s6-tcpserver4-socketbinder.c
index a37fae1..c02c3a6 100644
--- a/src/conn-tools/s6-tcpserver4-socketbinder.c
+++ b/src/conn-tools/s6-tcpserver4-socketbinder.c
@@ -3,13 +3,13 @@
#include <skalibs/nonposix.h>
#include <stdint.h>
#include <unistd.h>
+#include <fcntl.h>
#include <sys/socket.h>
#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/fmtscan.h>
#include <skalibs/strerr2.h>
-#include <skalibs/djbunix.h>
#include <skalibs/socket.h>
#include <skalibs/exec.h>
@@ -21,7 +21,7 @@ int main (int argc, char const *const *argv)
unsigned int backlog = SOMAXCONN ;
int flagreuse = 1 ;
int flagudp = 0 ;
- int flagblocking = 0 ;
+ unsigned int flags = O_NONBLOCK ;
char ip[4] ;
uint16_t port ;
PROG = "s6-tcpserver4-socketbinder" ;
@@ -37,7 +37,7 @@ int main (int argc, char const *const *argv)
case 'd' : flagreuse = 1 ; break ;
case 'M' : flagudp = 0 ; break ;
case 'm' : flagudp = 1 ; break ;
- case 'B' : flagblocking = 1 ; break ;
+ case 'B' : flags = 0 ; break ;
case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ;
default : dieusage() ;
}
@@ -47,7 +47,7 @@ int main (int argc, char const *const *argv)
if (argc < 3) dieusage() ;
if (!ip4_scan(argv[0], ip) || !uint160_scan(argv[1], &port)) dieusage() ;
close(0) ;
- if (flagudp ? socket_udp4_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB) : socket_tcp4_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB))
+ if (flagudp ? socket_udp4_internal(flags) : socket_tcp4_internal(flags))
strerr_diefu1sys(111, "create socket") ;
if ((flagreuse ? socket_bind4_reuse(0, ip, port) : socket_bind4(0, ip, port)) < 0)
strerr_diefu5sys(111, "bind to ", argv[0], ":", argv[1], " ") ;