summaryrefslogtreecommitdiff
path: root/src/libstddjb/unsanitize_read.c
blob: d21cacd4d6c2136ac3b24b3c2ae20934fa3ed07e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <sys/types.h>
#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/allreadwrite.h>

ssize_t unsanitize_read (ssize_t r)
{
  return r == -1 ? errno == EPIPE ? (errno = 0, 0) : -1 :
         !r ? (errno = EWOULDBLOCK, -1) : r ;
}