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

#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 ;
}