summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@divmod.com>2010-05-23 15:22:08 (GMT)
committerJean-Paul Calderone <exarkun@divmod.com>2010-05-23 15:22:08 (GMT)
commitc28d554db8278d7346ff28da2defb59d413f857e (patch)
treef55c0d609f0b01b21aee03df27dac8b10bde6e5b /Modules
parentadd85daa876ecd0f7e5b035ec065f933908761fb (diff)
downloadcpython-c28d554db8278d7346ff28da2defb59d413f857e.zip
cpython-c28d554db8278d7346ff28da2defb59d413f857e.tar.gz
cpython-c28d554db8278d7346ff28da2defb59d413f857e.tar.bz2
Merged revisions 74426 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74426 | gregory.p.smith | 2009-08-13 14:54:50 -0400 (Thu, 13 Aug 2009) | 4 lines Fix issue1628205: Socket file objects returned by socket.socket.makefile() now properly handles EINTR within the read, readline, write & flush methods. The socket.sendall() method now properly handles interrupted system calls. ........
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 bfe53f1..a28116c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2723,8 +2723,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);