On Wed, Mar 31, 2010 at 12:17:24AM +0200, Johannes Sixt wrote: > This could deadlock in the theoretical case that the read() in the parent > returns an error even though the child is still writing data; the child would > hang while waiting for the pipe being drained by the parent; but the parent > would wait for the child to exit, which never happens. Doing the close() > before finish_command() avoids this situation because the child dies of > SIGPIPE. Yeah, I actually thought about that while writing the error case for strbuf_read (I do close(child.out) before finish_command). But I didn't consider it in the success case. I don't think it matters here because we will already have gotten EOF from child.out, which should mean the child is no longer writing and will not block. So I am not sure there is any deadlock, but I am fine with your version of the patch. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html