summaryrefslogtreecommitdiff
path: root/external/bsd/file/dist/src/pread.c
blob: b12559f4bcc44753f1e57ad4eb9ce4fc1f6ae2e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*	$NetBSD: pread.c,v 1.1.1.2 2013/12/01 19:28:16 christos Exp $	*/

#include "file.h"
#ifndef lint
#if 0
FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $")
#else
__RCSID("$NetBSD: pread.c,v 1.1.1.2 2013/12/01 19:28:16 christos Exp $");
#endif
#endif  /* lint */
#include <fcntl.h>
#include <unistd.h>

ssize_t
pread(int fd, void *buf, size_t len, off_t off) {
	if (lseek(fd, off, SEEK_SET) == (off_t)-1)
		return -1;

	return read(fd, buf, len);
}