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 <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Linus Torvalds committed
Feb 11, 2006 at 10:41 UTC
98deeaa82fb2b96395854e0574272ed21cbd81fe
1 file changed
+7
-4
fetch-clone.c
+7
-4
@@ -178,10 +178,13 @@ int receive_keep_pack(int fd[2], const char *me, int quiet)
178
if (sz == 0)
179
break;
180
if (sz < 0) {
181
- error("error reading pack (%s)", strerror(errno));
182
- close(ofd);
183
- unlink(tmpfile);
184
- return -1;
181
+ if (errno != EINTR && errno != EAGAIN) {
182
+ error("error reading pack (%s)", strerror(errno));
183
+ close(ofd);
184
+ unlink(tmpfile);
185
+ return -1;
186
+ }
187
+ sz = 0;
188
}
189
pos = 0;
190
while (pos < sz) {