summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d6249e)
raw | patch | inline | side by side (parent: 1d6249e)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 15 Aug 2006 23:28:08 +0000 (16:28 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 16 Aug 2006 04:02:16 +0000 (21:02 -0700) |
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>
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>
connect.c | patch | blob | history |
diff --git a/connect.c b/connect.c
index 4422a0d8d38c225c6c4716ce8ff826bc1acbd981..b9c222085ee1390c8f0c02f63304193fa78ce677 100644 (file)
--- a/connect.c
+++ b/connect.c
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;
}