plugins/nbd/nbd.c
/* Read an entire buffer, returning 0 on success or -1 with errno set. */
Read an entire buffer, returning 0 on success or -1 with errno set.
Read an entire buffer returning 0 on success or - 1 with errno set .
static int
read_full (int fd, void *buf, size_t len)
{
  ssize_t r;
  while (len) {
    r = read (fd, buf, len);
    if (r < 0) {
      if (errno == EINTR || errno == EAGAIN)
        continue;
      return -1;
    }
    if (!r) {
      errno = EBADMSG;
      return -1;
    }
    buf += r;
    len -= r;
  }
  return 0;
}
static int read_full ( int fd , void * buf , size_t len ) { ssize_t r ; while ( len ) { r = read ( fd , buf , len ) ; if ( r < 0 ) { if ( errno == EINTR || errno == EAGAIN ) continue ; return -1 ; } if ( ! r ) { errno = EBADMSG ; return -1 ; } buf += r ; len -= r ; } return 0 ; }
Read an entire buffer, returning 0 on success or -1 with errno set.
Read an entire buffer returning 0 on success or - 1 with errno set .
/* Unexpected EOF */