[glib] The SO_KEEPALIVE value seems to actually be a char on Windows
- From: Tor Lillqvist <tml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] The SO_KEEPALIVE value seems to actually be a char on Windows
- Date: Fri, 12 Mar 2010 08:47:06 +0000 (UTC)
commit a57522deae75264bade35eae8826cda2771530c6
Author: Tor Lillqvist <tml iki fi>
Date: Fri Mar 12 10:42:43 2010 +0200
The SO_KEEPALIVE value seems to actually be a char on Windows
Do still use a BOOL variable, but initialize it to FALSE before the
getsockopt(), and drop the assertion on Windows. Should fix bug
gio/gsocket.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 1c18b11..398c4d5 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -305,7 +305,8 @@ g_socket_details_from_fd (GSocket *socket)
int value;
int errsv;
#ifdef G_OS_WIN32
- BOOL bool_val;
+ /* See bug #611756 */
+ BOOL bool_val = FALSE;
#else
int bool_val;
#endif
@@ -388,7 +389,14 @@ g_socket_details_from_fd (GSocket *socket)
if (getsockopt (fd, SOL_SOCKET, SO_KEEPALIVE,
(void *)&bool_val, &optlen) == 0)
{
+#ifndef G_OS_WIN32
+ /* Experimentation indicates that the SO_KEEPALIVE value is
+ * actually a char on Windows, even if documentation claims it
+ * to be a BOOL which is a typedef for int. So this g_assert()
+ * fails. See bug #611756.
+ */
g_assert (optlen == sizeof bool_val);
+#endif
socket->priv->keepalive = !!bool_val;
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]