miniroon

Simplistic macaroon-based authorization for Unix systems
git clone https://ccx.te2000.cz/git/miniroon
Log | Files | Refs

fd_util.c (317B)


      1 #include <fcntl.h>
      2 
      3 #include <skalibs/strerr.h>
      4 
      5 #include "fd_util.h"
      6 
      7 void fd_block(int fd) {
      8     int flags = fcntl(fd, F_GETFL);
      9     if(flags == -1) {
     10         strerr_dief1sys(111, "fcntl() getfd");
     11     }
     12     if(fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) < 0) {
     13         strerr_dief1sys(111, "fcntl() setfd");
     14     }
     15 }
     16 
     17