Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 3665:5188374377ae legacy-trunk
Get rid of obsolete allowbroadcast().
Avoid core dumps in resizestring().
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 11 Jun 1996 18:35:24 +0000 |
| parents | 564912267290 |
| children | 556ec82f4d93 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Tue Jun 11 18:33:14 1996 +0000 +++ b/Modules/socketmodule.c Tue Jun 11 18:35:24 1996 +0000 @@ -471,27 +471,6 @@ } -#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 @@ 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 @@ 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);
