Download raw body.
fix non-portable use of pipe(2)
On Thu, Jun 17, 2021 at 06:45:55AM -0600, Todd C. Miller wrote: > On Thu, 17 Jun 2021 14:30:42 +0200, Stefan Sperling wrote: > > > The 'got fetch' command relies on bi-directional communication over > > a pipe. > > Any reason to not just use socketpair(2) which is bi-directional? Nice, thanks a lot for this hint. The much smaller diff below also fixes this issue on Linux. > I suppose modern pipe implementations are intwined with the VM > subsystem and might be faster. I don't think it's worth caring about that. diff 1d0f405485b02cc4480ea188879e4122e0ea32bd /home/stsp/src/got blob - 0c3e36643b33aa891a6ae0ca06eac2c739842c4c file + lib/fetch.c --- 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) {
fix non-portable use of pipe(2)