From 52476716ad2bff9805e5749bf2c2a1f9d3512ec9 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 18 Jan 2009 16:19:25 -0600 Subject: Add mkswap. --- lib/lib.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/lib.c') diff --git a/lib/lib.c b/lib/lib.c index 89c8781b..a5bf4755 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -266,6 +266,16 @@ void xwrite(int fd, void *buf, size_t len) if (len != writeall(fd, buf, len)) perror_exit("xwrite"); } +// Die if lseek fails, probably due to being called on a pipe. + +off_t xlseek(int fd, off_t offset, int whence) +{ + offset = lseek(fd, offset, whence); + if (offset<0) perror_exit("lseek"); + + return offset; +} + char *xgetcwd(void) { char *buf = getcwd(NULL, 0); -- cgit v1.2.3