diff --git a/libpkg/fetch.c b/libpkg/fetch.c index 5423e20..cbbea34 100644 --- a/libpkg/fetch.c +++ b/libpkg/fetch.c @@ -324,6 +324,13 @@ pkg_fetch_file_to_fd(struct pkg_repo *repo, const char *url, int dest, time_t *t ts.tv_sec = fetch_timeout; ts.tv_nsec = 0; if (kevent(kq, &e, 1, &ev, 1, &ts) == -1) { + if (time(NULL) - now > fetch_timeout) { + pkg_emit_error("Fetch time out"); + retcode = EPKG_FATAL; + goto cleanup; + } + if (errno == EINTR) + continue; pkg_emit_errno("kevent", "ssh"); retcode = EPKG_FATAL; goto cleanup;