aboutsummaryrefslogtreecommitdiff
path: root/src/util/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/network.c')
-rw-r--r--src/util/network.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/util/network.c b/src/util/network.c
index e771a9834..014701e02 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -122,7 +122,7 @@ GNUNET_NETWORK_test_pf (int pf)
122 } 122 }
123 else 123 else
124 { 124 {
125 close (s); 125 GNUNET_break (0 == close (s));
126 ret = GNUNET_OK; 126 ret = GNUNET_OK;
127 } 127 }
128 switch (pf) 128 switch (pf)
@@ -506,15 +506,15 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
506#endif 506#endif
507 if (AF_UNIX == address->sa_family) 507 if (AF_UNIX == address->sa_family)
508 GNUNET_NETWORK_unix_precheck ((const struct sockaddr_un *) address); 508 GNUNET_NETWORK_unix_precheck ((const struct sockaddr_un *) address);
509
509 { 510 {
510 const int on = 1; 511 const int on = 1;
511 512
512 /* This is required here for TCP sockets, but only on UNIX */ 513 if ( (SOCK_STREAM == desc->type) &&
513 if ((SOCK_STREAM == desc->type) && 514 (0 != setsockopt (desc->fd,
514 (0 != setsockopt (desc->fd, 515 SOL_SOCKET,
515 SOL_SOCKET, 516 SO_REUSEADDR,
516 SO_REUSEADDR, 517 &on, sizeof(on))) )
517 &on, sizeof(on))))
518 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, 518 LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG,
519 "setsockopt"); 519 "setsockopt");
520 } 520 }
@@ -883,15 +883,13 @@ GNUNET_NETWORK_socket_setsockopt (struct GNUNET_NETWORK_Handle *fd,
883 const void *option_value, 883 const void *option_value,
884 socklen_t option_len) 884 socklen_t option_len)
885{ 885{
886 int ret; 886 return (0 == setsockopt (fd->fd,
887 887 level,
888 ret = setsockopt (fd->fd, 888 option_name,
889 level, 889 option_value,
890 option_name, 890 option_len))
891 option_value, 891 ? GNUNET_OK
892 option_len); 892 : GNUNET_SYSERR;
893
894 return ret == 0 ? GNUNET_OK : GNUNET_SYSERR;
895} 893}
896 894
897 895