From a05a9101b69250bde49e365fef74af08497ab6fd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 5 Feb 2012 16:42:41 +0100 Subject: pysocketwrapper: fix behaviour to be consistent with 'socket.getsockopt' socklen_t is unsigned --- lib/socket_wrapper/py_socket_wrapper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/socket_wrapper') diff --git a/lib/socket_wrapper/py_socket_wrapper.c b/lib/socket_wrapper/py_socket_wrapper.c index 5c8af03124..f5742d3dd1 100644 --- a/lib/socket_wrapper/py_socket_wrapper.c +++ b/lib/socket_wrapper/py_socket_wrapper.c @@ -374,7 +374,7 @@ static PyObject *py_socket_getsockopt(pytalloc_Object *self, PyObject *args) { int level, optname; int *sock; - socklen_t optlen = -1, newlen; + socklen_t optlen = 0, newlen; int optval; bool is_integer = false; char *buffer; @@ -385,7 +385,7 @@ static PyObject *py_socket_getsockopt(pytalloc_Object *self, PyObject *args) return NULL; } - if (optlen < 0) { + if (optlen == 0) { optlen = sizeof(int); is_integer = true; } -- cgit