summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-01-04 03:29:50 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-01-04 03:29:50 (GMT)
commitb585a0ff03ade21e21ac7510dd667e11eadd9b8b (patch)
tree46a6d86ae81d6324b4fb4759a41de986686b1ebc /Modules
parentaea4428fdc8a9f1a77ddc1099442ca5db9db7e78 (diff)
downloadcpython-b585a0ff03ade21e21ac7510dd667e11eadd9b8b.zip
cpython-b585a0ff03ade21e21ac7510dd667e11eadd9b8b.tar.gz
cpython-b585a0ff03ade21e21ac7510dd667e11eadd9b8b.tar.bz2
Merge the trivial portion of r74426 from trunk.
socket.sendall() now handles EINTR properly internally.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 7b6046d..fa543cd 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2572,8 +2572,21 @@ sock_sendall(PySocketSockObject *s, PyObject *args)
#else
n = send(s->sock_fd, buf, len, flags);
#endif
- if (n < 0)
+ if (n < 0) {
+#ifdef EINTR
+ /* We must handle EINTR here as there is no way for
+ * the caller to know how much was sent otherwise. */
+ if (errno == EINTR) {
+ /* Run signal handlers. If an exception was
+ * raised, abort and leave this socket in
+ * an unknown state. */
+ if (PyErr_CheckSignals())
+ return NULL;
+ continue;
+ }
+#endif
break;
+ }
buf += n;
len -= n;
} while (len > 0);