X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=util.c;h=53f5bdffffd7c0aa1835037259c007cad77613b3;hp=cfa6b4ccbd5ee6008aca3dee1a99003a6046c403;hb=c0f98550914a4c7ad47c7520ece73ab474c9a818;hpb=ccf25024a3b46e9ca2b1842883b2f0953daf4842 diff --git a/util.c b/util.c index cfa6b4c..53f5bdf 100644 --- a/util.c +++ b/util.c @@ -170,6 +170,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",