summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-05-16 06:52:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-16 23:20:01 (GMT)
commit7ffe853b106680720ddec999e1daf5c186997a1f (patch)
treeaa8f55a2816c515f502018acbbaef30992afe8c0 /connect.c
parent5cbf8246d2e68470648d123e356665fca9ffca73 (diff)
downloadgit-7ffe853b106680720ddec999e1daf5c186997a1f.zip
git-7ffe853b106680720ddec999e1daf5c186997a1f.tar.gz
git-7ffe853b106680720ddec999e1daf5c186997a1f.tar.bz2
connect: let callers know if connection is a socket
They might care because they want to do a half-duplex close. With pipes, that means simply closing the output descriptor; with a socket, you must actually call shutdown. Instead of exposing the magic no_fork child_process struct, let's encapsulate the test in a function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index 5884f6d..9b31af0 100644
--- a/connect.c
+++ b/connect.c
@@ -633,10 +633,15 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
return conn;
}
+int git_connection_is_socket(struct child_process *conn)
+{
+ return conn == &no_fork;
+}
+
int finish_connect(struct child_process *conn)
{
int code;
- if (!conn || conn == &no_fork)
+ if (!conn || git_connection_is_socket(conn))
return 0;
code = finish_command(conn);