git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fix fetch-clone in the presense of signals
@ 2006-02-11 18:41 Linus Torvalds
  0 siblings, 0 replies; only message in thread
From: Linus Torvalds @ 2006-02-11 18:41 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


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 <torvalds@osdl.org>
---

diff --git a/fetch-clone.c b/fetch-clone.c
index b67d976..d8216cb 100644
--- a/fetch-clone.c
+++ b/fetch-clone.c
@@ -153,10 +153,13 @@ int receive_keep_pack(int fd[2], const c
 		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) {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-11 18:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-11 18:41 Fix fetch-clone in the presense of signals Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).