summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-15 23:28:08 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-08-16 04:02:16 (GMT)
commit53e1a761be8d338cd957870bc1e48a8c15d7d2c0 (patch)
treeeebe330e39ee4882629f92e04feeceaf89e26e45
parent1d6249e609289940dca179b626fe4ae5433c90cc (diff)
downloadgit-53e1a761be8d338cd957870bc1e48a8c15d7d2c0.zip
git-53e1a761be8d338cd957870bc1e48a8c15d7d2c0.tar.gz
git-53e1a761be8d338cd957870bc1e48a8c15d7d2c0.tar.bz2
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>
-rw-r--r--connect.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/connect.c b/connect.c
index 4422a0d..b9c2220 100644
--- a/connect.c
+++ b/connect.c
@@ -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;
}