summaryrefslogtreecommitdiff
path: root/src/libstddjb/coe.c
blob: a32c4efae5f42c72d417640f86d367a9c8426698 (plain)
1
2
3
4
5
6
7
8
9
10
/* ISC license. */

#include <fcntl.h>
#include <skalibs/djbunix.h>

int coe (int fd)
{
  int flags = fcntl(fd, F_GETFD, 0) ;
  return flags < 0 ? flags : flags & FD_CLOEXEC ? 0 : fcntl(fd, F_SETFD, flags | FD_CLOEXEC) ;
}