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