summaryrefslogtreecommitdiff
path: root/src/libnsss/nsss_unix_rewind.c
blob: 2b8c6b3d642910efaed305b34f34e74d4353d000 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* ISC license. */

#include <unistd.h>
#include <skalibs/buffer.h>
#include <nsss/nsss-unix.h>

int nsss_unix_rewind (nsss_unix_t *a)
{
  int fd = buffer_fd(&a->b) ;
  if (lseek(fd, 0, SEEK_SET) < 0) return 0 ;
  buffer_init(&a->b, &buffer_read, fd, a->buf, NSSS_UNIX_BUFSIZE) ;
  return 1 ;
}