Re: git-daemon problem

From: Junio C Hamano <junkio@cox.net>
Date: 2006-07-12 09:32:34
Matthias Lederhofer <matled@gmx.net> writes:

> A few weeks ago upgrading from 1.3.x to 1.4.1 I had a problem with
> git-daemon.  I started git-daemon on a terminal but did not redirect
> stdin/stdout/stderr to /dev/null (actually using daemon(8) on freebsd
> without -f but just disowning the process and closing the terminal
> works fine too, nothing freebsd/daemon(8) specific).

This is because the server side closes fd #2 in such a setup,
and we still wrote using safe_write() into it.  Thanks for
spotting.

Would this replacement patch help?

diff --git a/upload-pack.c b/upload-pack.c
index b18eb9b..44038d3 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -51,6 +51,13 @@ static ssize_t send_client_data(int fd, 
 		if (fd == 3)
 			/* emergency quit */
 			fd = 2;
+		if (fd == 2) {
+			/* people sometomes close fd 2 on the server
+			 * side -- making safe_write() to barf.
+			 */
+			write(2, data, sz);
+			return sz;
+		}
 		return safe_write(fd, data, sz);
 	}
 	p = data;

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Jul 12 09:33:26 2006

This archive was generated by hypermail 2.1.8 : 2006-07-12 09:33:53 EST