summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSimmo Saan <simmo.saan@gmail.com>2016-02-05 13:44:14 +0200
committerSimmo Saan <simmo.saan@gmail.com>2016-02-05 13:44:14 +0200
commitb12412ed17a9461c29f274a8448236ee057d3122 (patch)
tree75a16560b6afa239d610973e8224bfac43d2a58b /src/plugins
parent438f2dee3ed16f4f972ca682ffa05e345f35987a (diff)
downloadweechat-b12412ed17a9461c29f274a8448236ee057d3122.zip
xfer: ignore signals when polling socket during file receive (closes #677)
When signals (e.g. SIGWINCH for terminal resize) are fired they cause poll to fail with EINTR, erroring file receival even when there wasn't a problem with it. This patch adds additional checks for EINTR and EAGAIN that cause retry of poll, since both are unrelated to actual file receival.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/xfer/xfer-dcc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/xfer/xfer-dcc.c b/src/plugins/xfer/xfer-dcc.c
index 4ea5e43bf..24821d7e1 100644
--- a/src/plugins/xfer/xfer-dcc.c
+++ b/src/plugins/xfer/xfer-dcc.c
@@ -368,9 +368,14 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer)
ready = poll (&poll_fd, 1, -1);
if (ready <= 0)
{
- xfer_network_write_pipe (xfer, XFER_STATUS_FAILED,
- XFER_ERROR_RECV_BLOCK);
- return;
+ if ((errno == EINTR) || (errno == EAGAIN))
+ continue;
+ else
+ {
+ xfer_network_write_pipe (xfer, XFER_STATUS_FAILED,
+ XFER_ERROR_RECV_BLOCK);
+ return;
+ }
}
/* read maximum data on socket (until nothing is available) */