use socketpair(2) instead of pipe(2) for bi-directional communication On Linux, pipes returned from pipe(2) only work in one direction. This broke 'got clone' over ssh in the -portable version because got-fetch-pack assumes it can use its fetchfd for both reading and writing. I wrote a complicated diff to use two pipe(2) calls instead of one, but millert suggested a simpler solution: Use socketpair(2) instead of pipe(2). ok millert jrick tracey
diff --git a/lib/fetch.c b/lib/fetch.c
index 0c3e366..798e728 100644
--- a/lib/fetch.c
+++ b/lib/fetch.c
@@ -118,8 +118,8 @@ dial_ssh(pid_t *fetchpid, int *fetchfd, const char *host, const char *port,
argv[i++] = (char *)path;
argv[i++] = NULL;
- if (pipe(pfd) == -1)
- return got_error_from_errno("pipe");
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pfd) == -1)
+ return got_error_from_errno("socketpair");
pid = fork();
if (pid == -1) {