summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-06-11 18:35:24 (GMT)
committerGuido van Rossum <guido@python.org>1996-06-11 18:35:24 (GMT)
commit53a9bf816487589dd0bc9fffe789de83e54305f2 (patch)
tree3b6cd218203bb23c8ba6ee81afee1706b20285bb /Modules/socketmodule.c
parentab28c56fd39f0edc24e2765d5b69b7f7c21d9d71 (diff)
downloadcpython-53a9bf816487589dd0bc9fffe789de83e54305f2.zip
cpython-53a9bf816487589dd0bc9fffe789de83e54305f2.tar.gz
cpython-53a9bf816487589dd0bc9fffe789de83e54305f2.tar.bz2
Get rid of obsolete allowbroadcast().
Avoid core dumps in resizestring().
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 5b971f8..b77bdac 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -471,27 +471,6 @@ BUILD_FUNC_DEF_2(PySocketSock_accept,PySocketSockObject *,s, PyObject *,args)
}
-#if 0
-/* s.allowbroadcast() method */
-/* XXX obsolete -- will disappear in next release */
-
-static PyObject *
-BUILD_FUNC_DEF_2(PySocketSock_allowbroadcast,PySocketSockObject *,s, PyObject *,args)
-{
- int flag;
- int res;
- if (!PyArg_Parse(args, "i", &flag))
- return NULL;
- res = setsockopt(s->sock_fd, SOL_SOCKET, SO_BROADCAST,
- (ANY *)&flag, sizeof flag);
- if (res < 0)
- return PySocket_Err();
- Py_INCREF(Py_None);
- return Py_None;
-}
-#endif
-
-
/* s.setblocking(1 | 0) method */
static PyObject *
@@ -789,7 +768,7 @@ BUILD_FUNC_DEF_2(PySocketSock_recv,PySocketSockObject *,s, PyObject *,args)
Py_DECREF(buf);
return PySocket_Err();
}
- if (_PyString_Resize(&buf, n) < 0)
+ if (n != len && _PyString_Resize(&buf, n) < 0)
return NULL;
return buf;
}
@@ -826,7 +805,7 @@ BUILD_FUNC_DEF_2(PySocketSock_recvfrom,PySocketSockObject *,s, PyObject *,args)
Py_DECREF(buf);
return PySocket_Err();
}
- if (_PyString_Resize(&buf, n) < 0)
+ if (n != len && _PyString_Resize(&buf, n) < 0)
return NULL;
addr = makesockaddr((struct sockaddr *)addrbuf, addrlen);
ret = Py_BuildValue("OO", buf, addr);