commit 9ec58fff16b1c2fc1d33d9955b42cadaa9e26f29 from: Stefan Sperling date: Thu Jun 17 15:41:49 2021 UTC 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 commit - 8e09a16893e9f1d76a82e99d79fbceaabb6f4bd0 commit + 9ec58fff16b1c2fc1d33d9955b42cadaa9e26f29 blob - 0c3e36643b33aa891a6ae0ca06eac2c739842c4c blob + 798e728b740269a24d6c9570992490578f0ce78c --- lib/fetch.c +++ lib/fetch.c @@ -118,8 +118,8 @@ dial_ssh(pid_t *fetchpid, int *fetchfd, const char *ho 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) {