-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
In the latest code below, it was found that pv__transfer_write_repeated() could return 0 due to EINTR. When it happens, the data is not moving any more.
487 static int pv__transfer_write(pvstate_t state, int fd,
488 int *eof_in, int *eof_out,
489 long *lineswritten)
490 {
491 ssize_t nwritten;
492
493 signal(SIGALRM, SIG_IGN);
494 alarm(1);
495
496 nwritten = pv__transfer_write_repeated(STDOUT_FILENO,
497 state->transfer_buffer +
498 state->write_position,
499 state->to_write);
500
501 alarm(0);
502
503 if (0 == nwritten) {
504 /*
505 * Write returned 0 - EOF on stdout.
506 */
507 *eof_out = 1;
508 return 1;
509 } else if (nwritten > 0) {
510 /*
An experiment below seems solving the problem... Could you kindly check whether this is the case>
diff --git a/src/pv/transfer.c b/src/pv/transfer.c
index ee33df0..38b7df5 100644
--- a/src/pv/transfer.c
+++ b/src/pv/transfer.c
@@ -501,6 +501,14 @@ static int pv__transfer_write(pvstate_t state, int fd,
alarm(0);
if (0 == nwritten) {
-
if ((EINTR == errno) || (EAGAIN == errno)) { -
struct timeval tv; -
tv.tv_sec = 0; -
tv.tv_usec = 10000; -
select(0, NULL, NULL, NULL, &tv); -
return 0; -
} -
/* * Write returned 0 - EOF on stdout.
Metadata
Metadata
Assignees
Labels
No labels