summaryrefslogtreecommitdiffstats
path: root/lib/libfetch/common.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-07-17 20:49:39 +0000
committerdes <des@FreeBSD.org>2000-07-17 20:49:39 +0000
commitc1df3803c6ae4824f4b9e6dda8f88882598fb5b7 (patch)
treefc541174b9bd01ba292e8033c9dc5fad39f3d386 /lib/libfetch/common.c
parent94b736448402e59ddb377056dc08e1470a95fb1d (diff)
downloadFreeBSD-src-c1df3803c6ae4824f4b9e6dda8f88882598fb5b7.zip
FreeBSD-src-c1df3803c6ae4824f4b9e6dda8f88882598fb5b7.tar.gz
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.
Diffstat (limited to 'lib/libfetch/common.c')
-rw-r--r--lib/libfetch/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index e4dbf3a..c03b1f5 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -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;
OpenPOWER on IntegriCloud