Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run-command.c9
-rw-r--r--run-command.h1
-rw-r--r--send-pack.c5
3 files changed, 12 insertions, 3 deletions
diff --git a/run-command.c b/run-command.c
index 84b883c213..3c3b8814df 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1246,6 +1246,15 @@ int finish_async(struct async *async)
#endif
}
+int async_with_fork(void)
+{
+#ifdef NO_PTHREADS
+ return 1;
+#else
+ return 0;
+#endif
+}
+
const char *find_hook(const char *name)
{
static struct strbuf path = STRBUF_INIT;
diff --git a/run-command.h b/run-command.h
index 9b7f38202c..68f5369fc2 100644
--- a/run-command.h
+++ b/run-command.h
@@ -141,6 +141,7 @@ struct async {
int start_async(struct async *async);
int finish_async(struct async *async);
int in_async(void);
+int async_with_fork(void);
void check_pipe(int err);
/**
diff --git a/send-pack.c b/send-pack.c
index e920ca57df..f692686770 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -203,9 +203,8 @@ static int receive_status(int in, struct ref *refs)
static int sideband_demux(int in, int out, void *data)
{
int *fd = data, ret;
-#ifdef NO_PTHREADS
- close(fd[1]);
-#endif
+ if (async_with_fork())
+ close(fd[1]);
ret = recv_sideband("send-pack", fd[0], out);
close(out);
return ret;