Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 1132:6461dac9a9f2 legacy-trunk
* mymalloc.h: always allocate one extra byte, since some malloc's
return NULL for malloc(0) or realloc(p, 0). (This should be done
differently than wasting one byte, but alas...)
* Moved "add'l libraries" option in Makefile to an earlier place.
* Remove argument compatibility hacks (b) and (c).
* Add grey2mono, dither2mono and mono2grey to imageop.
* Dup the fd in socket.fromfd().
* Added new modules mpz, md5 (by JH, requiring GNU MP 1.2). Affects
Makefile and config.c.
* socketmodule.c: added socket.fromfd(fd, family, type, [proto]),
converted socket() to use of getargs().
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 14 Dec 1992 16:59:51 +0000 |
| parents | 3dd7b8255619 |
| children | b564bd4e57e1 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Mon Dec 14 16:40:24 1992 +0000 +++ b/Modules/socketmodule.c Mon Dec 14 16:59:51 1992 +0000 @@ -975,6 +975,10 @@ if (!getargs(args, "(iiii)", &fd, &family, &type, &proto)) return NULL; } + /* Dup the fd so it and the socket can be closed independently */ + fd = dup(fd); + if (fd < 0) + return socket_error(); s = newsockobject(fd, family, type, proto); /* From now on, ignore SIGPIPE and let the error checking do the work. */
