From: Jelmer Vernooij Date: Sun, 5 Feb 2012 15:42:41 +0000 (+0100) Subject: pysocketwrapper: fix behaviour to be consistent with 'socket.getsockopt' X-Git-Tag: tevent-0.9.15~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a05a9101b69250bde49e365fef74af08497ab6fd;p=thirdparty%2Fsamba.git pysocketwrapper: fix behaviour to be consistent with 'socket.getsockopt' socklen_t is unsigned --- diff --git a/lib/socket_wrapper/py_socket_wrapper.c b/lib/socket_wrapper/py_socket_wrapper.c index 5c8af03124a..f5742d3dd10 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; }