summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2009-08-13 18:54:50 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2009-08-13 18:54:50 (GMT)
commitc4ad0345cf7789dc432ff57ab644db230d8baf1c (patch)
tree984552a9edaf0637ce702e8ffbf07029cac53e8d /Modules
parentaa66a968d4842c7dca0063c27520162d96fd7fe7 (diff)
downloadcpython-c4ad0345cf7789dc432ff57ab644db230d8baf1c.zip
cpython-c4ad0345cf7789dc432ff57ab644db230d8baf1c.tar.gz
cpython-c4ad0345cf7789dc432ff57ab644db230d8baf1c.tar.bz2
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 b5f53a3..5575855 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2736,8 +2736,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);