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

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

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