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

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

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