summaryrefslogtreecommitdiff
path: root/src/libstddjb/buffer_getvallnf.c
blob: e0a2d0ac88e74baf9dd3277d76afb79afbdb9eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* ISC license. */

#include <sys/uio.h>
#include <errno.h>
#include <skalibs/siovec.h>
#include <skalibs/buffer.h>

int buffer_getvallnofill (buffer *b, struct iovec const *v, unsigned int n)
{
  size_t r = buffer_getvnofill(b, v, n) ;
  if (r < siovec_len(v, n))
  {
    buffer_unget(b, r) ;
    return (errno = ENOBUFS, 0) ;
  }
  return 1 ;
}