author | Junio C Hamano <junkio@cox.net> | |
Mon, 22 Jan 2007 01:10:51 +0000 (17:10 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 22 Jan 2007 05:51:01 +0000 (21:51 -0800) | ||
commit | ec587fde0a76780931c7ac32474c8c000aa45134 | |
tree | 8b1e608dd2f2641adbfe06cc4c0047ceb88c9d53 | tree | snapshot |
parent | 026aa93818a536c819a94aae5bbefe1b6251fe0e | commit | diff |
Make sure git_connect() always give two file descriptors.
Earlier, git_connect() returned the same fd twice or two
separate fds, depending on the way the connection was made (when
we are talking to the other end over a single socket, we used
the same fd twice, and when our end is connected to a pipepair
we used two).
This forced callers who do close() and dup() to really care
which was which, and most of the existing callers got this
wrong, although without much visible ill effect. Many were
closing the same fd twice when we are talking over a single
socket, and one was leaking a fd.
This fixes it to uniformly use two separate fds, so if somebody
wants to close only reader side can just do close() on it
without worrying about it accidentally also closing the writer
side or vice versa.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Earlier, git_connect() returned the same fd twice or two
separate fds, depending on the way the connection was made (when
we are talking to the other end over a single socket, we used
the same fd twice, and when our end is connected to a pipepair
we used two).
This forced callers who do close() and dup() to really care
which was which, and most of the existing callers got this
wrong, although without much visible ill effect. Many were
closing the same fd twice when we are talking over a single
socket, and one was leaking a fd.
This fixes it to uniformly use two separate fds, so if somebody
wants to close only reader side can just do close() on it
without worrying about it accidentally also closing the writer
side or vice versa.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-archive.c | diff | blob | history | |
connect.c | diff | blob | history |