Raw File
Tip revision: e9ed2ce0dd1382301e3c8f6c5855e0af8bcb61a0 authored by Johnathan Wong on 25 January 2020, 00:11:36 UTC
azure: CI on macOS
Tip revision: e9ed2ce
#include "Fcontrol.h"
#include <fcntl.h>

/* Set the FD_CLOEXEC flag of the specified file descriptor. */
int setCloexec(int fd)
    int flags = fcntl(fd, F_GETFD, 0);
    if (flags == -1)
        return -1;
    flags |= FD_CLOEXEC;
    return fcntl(fd, F_SETFD, flags);
back to top