summaryrefslogtreecommitdiff
path: root/lib/socket_wrapper
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-02-05 16:42:41 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-02-07 01:11:07 +0100
commita05a9101b69250bde49e365fef74af08497ab6fd (patch)
tree2105e5689f62cc95ae2e6c8f93db00c27eec940f /lib/socket_wrapper
parent1c1b10f1d916e6d335aeb1e6f1425455f8662d7e (diff)
downloadsamba-a05a9101b69250bde49e365fef74af08497ab6fd.tar.gz
samba-a05a9101b69250bde49e365fef74af08497ab6fd.tar.bz2
samba-a05a9101b69250bde49e365fef74af08497ab6fd.zip
pysocketwrapper: fix behaviour to be consistent with 'socket.getsockopt'
socklen_t is unsigned
Diffstat (limited to 'lib/socket_wrapper')
-rw-r--r--lib/socket_wrapper/py_socket_wrapper.c4
1 files changed, 2 insertions, 2 deletions
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;
}