Skip to content

Commit

Permalink
finish_connect(): thinkofix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Aug 16, 2006
1 parent 1d6249e commit 53e1a76
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,9 @@ int git_connect(int fd[2], char *url, const char *prog)

int finish_connect(pid_t pid)
{
int ret;

for (;;) {
ret = waitpid(pid, NULL, 0);
if (!ret)
break;
while (waitpid(pid, NULL, 0) < 0) {
if (errno != EINTR)
break;
return -1;
}
return ret;
return 0;
}

0 comments on commit 53e1a76

Please sign in to comment.