finish_connect(): thinkofix
All but one callers have ignore the return value from this function, but the only caller, builtin-tar-tree.c::remote_tar(), assumed it returns non-zero on failure and zero on success. The implementation however was returning either the waited pid (which must be the same as its input) or -1 (an error). Fix this thinko, while getting rid of an assignment of return value from waitpid() into a variable of type int. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Aug 15, 2006 at 16:28 UTC
53e1a761be8d338cd957870bc1e48a8c15d7d2c0
1 file changed
+3
-8
connect.c
+3
-8
@@ -737,14 +737,9 @@ int git_connect(int fd[2], char *url, const char *prog)
737
738
int finish_connect(pid_t pid)
739
{
740
- int ret;
741
-
742
- for (;;) {
743
- ret = waitpid(pid, NULL, 0);
744
- if (!ret)
745
- break;
740
+ while (waitpid(pid, NULL, 0) < 0) {
741
if (errno != EINTR)
747
- break;
742
+ return -1;
743
}
749
- return ret;
744
+ return 0;
745
}