[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24231 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24231 - gnunet/src/util |
Date: |
Tue, 9 Oct 2012 00:41:27 +0200 |
Author: LRN
Date: 2012-10-09 00:41:27 +0200 (Tue, 09 Oct 2012)
New Revision: 24231
Modified:
gnunet/src/util/network.c
Log:
Implement non-inheritable sockets for W32
Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c 2012-10-08 21:36:32 UTC (rev 24230)
+++ gnunet/src/util/network.c 2012-10-08 22:41:27 UTC (rev 24231)
@@ -163,7 +163,6 @@
}
-#ifndef MINGW
/**
* Make a socket non-inheritable to child processes
*
@@ -174,8 +173,8 @@
static int
socket_set_inheritable (const struct GNUNET_NETWORK_Handle *h)
{
+#ifndef MINGW
int i;
-
i = fcntl (h->fd, F_GETFD);
if (i < 0)
return GNUNET_SYSERR;
@@ -184,9 +183,18 @@
i |= FD_CLOEXEC;
if (fcntl (h->fd, F_SETFD, i) < 0)
return GNUNET_SYSERR;
+#else
+ BOOL b;
+ SetLastError (0);
+ b = SetHandleInformation (h->fd, HANDLE_FLAG_INHERIT, 0);
+ if (!b)
+ {
+ SetErrnoFromWinsockError (WSAGetLastError ());
+ return GNUNET_SYSERR;
+ }
+#endif
return GNUNET_OK;
}
-#endif
#ifdef DARWIN
@@ -266,10 +274,11 @@
errno = EMFILE;
return GNUNET_SYSERR;
}
+#endif
if (GNUNET_OK != socket_set_inheritable (h))
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"socket_set_inheritable");
-#endif
+
if (GNUNET_SYSERR == socket_set_blocking (h, GNUNET_NO))
{
GNUNET_break (0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24231 - gnunet/src/util,
gnunet <=