Introduce the (undocumented) variable fetchRestartCalls, which controls whether
or not interrupted system calls will be restarted. This fixes a bug where fetch(1) would hang (potentially forever) if a server stopped responding, because the signal handler would absorb the user's efforts to interrupt the transfer.
This commit is contained in:
parent
7c80207e33
commit
a1bb3f482a
@ -262,7 +262,7 @@ _fetch_getln(int fd, char **buf, size_t *size, size_t *len)
|
||||
}
|
||||
r = select(fd+1, &readfds, NULL, NULL, &wait);
|
||||
if (r == -1) {
|
||||
if (errno == EINTR)
|
||||
if (errno == EINTR && fetchRestartCalls)
|
||||
continue;
|
||||
/* EBADF or EINVAL: shouldn't happen */
|
||||
return -1;
|
||||
@ -274,7 +274,7 @@ _fetch_getln(int fd, char **buf, size_t *size, size_t *len)
|
||||
if (r == 0)
|
||||
break;
|
||||
if (r == -1) {
|
||||
if (errno == EINTR)
|
||||
if (errno == EINTR && fetchRestartCalls)
|
||||
continue;
|
||||
/* any other error is bad news */
|
||||
return -1;
|
||||
|
@ -43,6 +43,7 @@
|
||||
int fetchLastErrCode;
|
||||
char fetchLastErrString[MAXERRSTRING];
|
||||
int fetchTimeout;
|
||||
int fetchRestartCalls = 1;
|
||||
|
||||
|
||||
/*** Local data **************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user