skalibs

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

sanitize_read.c (243B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/error.h>
      5 #include <skalibs/allreadwrite.h>
      6 
      7 ssize_t sanitize_read (ssize_t r)
      8 {
      9   return r == -1 ? error_isagain(errno) ? (errno = 0, 0) : -1 :
     10          !r ? (errno = EPIPE, -1) : r ;
     11 }