X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fio-layer%2Fsockets.c;h=6f8fdd50c4b653afafe310a21b374d298592bb78;hb=5ad1099341581dee94f77b32db728918e90fa64f;hp=285a1798e743ea5830b977d38824340088af206e;hpb=4d84028bd8d48b06a1858854715145e44378e6bd;p=mono.git diff --git a/mono/io-layer/sockets.c b/mono/io-layer/sockets.c index 285a1798e74..6f8fdd50c4b 100644 --- a/mono/io-layer/sockets.c +++ b/mono/io-layer/sockets.c @@ -778,6 +778,10 @@ int _wapi_setsockopt(guint32 fd, int level, int optname, gpointer handle = GUINT_TO_POINTER (fd); int ret; const void *tmp_val; +#if defined (__linux__) + /* This has its address taken so it cannot be moved to the if block which uses it */ + int bufsize = 0; +#endif struct timeval tv; if (startup_count == 0) { @@ -805,7 +809,7 @@ int _wapi_setsockopt(guint32 fd, int level, int optname, * buffer sizes "to allow space for bookkeeping * overhead." */ - int bufsize = *((int *) optval); + bufsize = *((int *) optval); bufsize /= 2; tmp_val = &bufsize; @@ -902,6 +906,7 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused, if (fd == -1 && domain == AF_INET && type == SOCK_RAW && protocol == 0) { /* Retry with protocol == 4 (see bug #54565) */ + // https://bugzilla.novell.com/show_bug.cgi?id=MONO54565 socket_handle.protocol = 4; fd = socket (AF_INET, SOCK_RAW, 4); } @@ -927,6 +932,7 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused, /* .net seems to set this by default for SOCK_STREAM, not for * SOCK_DGRAM (see bug #36322) + * https://bugzilla.novell.com/show_bug.cgi?id=MONO36322 * * It seems winsock has a rather different idea of what * SO_REUSEADDR means. If it's set, then a new socket can be @@ -937,6 +943,7 @@ guint32 _wapi_socket(int domain, int type, int protocol, void *unused, * behaves as though any other system would when SO_REUSEADDR * is true, so we don't need to do anything else here. See * bug 53992. + * https://bugzilla.novell.com/show_bug.cgi?id=MONO53992 */ { int ret, true = 1; @@ -1291,13 +1298,13 @@ WSAIoctl (guint32 fd, gint32 command, keepalivetime /= 1000; if (keepalivetime == 0 || rem >= 500) keepalivetime++; - ret = setsockopt (fd, SOL_TCP, TCP_KEEPIDLE, &keepalivetime, sizeof (uint32_t)); + ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepalivetime, sizeof (uint32_t)); if (ret == 0) { rem = keepaliveinterval % 1000; keepaliveinterval /= 1000; if (keepaliveinterval == 0 || rem >= 500) keepaliveinterval++; - ret = setsockopt (fd, SOL_TCP, TCP_KEEPINTVL, &keepaliveinterval, sizeof (uint32_t)); + ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepaliveinterval, sizeof (uint32_t)); } if (ret != 0) { gint errnum = errno;