X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/secnet/blobdiff_plain/56fd04e41e9985260b8c1660e299cfe051d3f260..6a06198cde5b96686304a9814dd7aa241adcb448:/util.c diff --git a/util.c b/util.c index fc6f626..aa85559 100644 --- a/util.c +++ b/util.c @@ -169,6 +169,13 @@ void setcloexec(int fd) { if (r<0) fatal_perror("fcntl(,F_SETFD,|FD_CLOEXEC) failed"); } +void pipe_cloexec(int fd[2]) { + int r=pipe(fd); + if (r) fatal_perror("pipe"); + setcloexec(fd[0]); + setcloexec(fd[1]); +} + static const char *phases[NR_PHASES]={ "PHASE_INIT", "PHASE_GETOPTS",