skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

coe.c (231B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/fcntl.h>
      4 #include <skalibs/djbunix.h>
      5 
      6 int coe (int fd)
      7 {
      8   int flags = fcntl(fd, F_GETFD, 0) ;
      9   return flags < 0 ? flags : flags & FD_CLOEXEC ? 0 : fcntl(fd, F_SETFD, flags | FD_CLOEXEC) ;
     10 }