From: Linus Torvalds Date: Sat, 11 Feb 2006 18:41:22 +0000 (-0800) Subject: Fix fetch-clone in the presense of signals X-Git-Tag: v1.2.0~17 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=98deeaa82fb2b96395854e0574272ed21cbd81fe;p=git.git Fix fetch-clone in the presense of signals We shouldn't fail a fetch just because a signal might have interrupted the read. Normally, we don't install any signal handlers, so EINTR really shouldn't happen. That said, really old versions of Linux will interrupt an interruptible system call even for signals that turn out to be ignored (SIGWINCH is the classic example - resizing your xterm would cause it). The same might well be true elsewhere too. Also, since receive_keep_pack() doesn't control the caller, it can't know that no signal handlers exist. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- diff --git a/fetch-clone.c b/fetch-clone.c index 873312df..da1b3ffb 100644 --- a/fetch-clone.c +++ b/fetch-clone.c @@ -178,10 +178,13 @@ int receive_keep_pack(int fd[2], const char *me, int quiet) if (sz == 0) break; if (sz < 0) { - error("error reading pack (%s)", strerror(errno)); - close(ofd); - unlink(tmpfile); - return -1; + if (errno != EINTR && errno != EAGAIN) { + error("error reading pack (%s)", strerror(errno)); + close(ofd); + unlink(tmpfile); + return -1; + } + sz = 0; } pos = 0; while (pos < sz) {