Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (11 sloc) 216 Bytes
#include "apue.h"
#include <fcntl.h>
int
set_cloexec(int fd)
{
int val;
if ((val = fcntl(fd, F_GETFD, 0)) < 0)
return(-1);
val |= FD_CLOEXEC; /* enable close-on-exec */
return(fcntl(fd, F_SETFD, val));
}