diff options
author | Rob Landley <rob@landley.net> | 2009-01-18 16:19:25 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2009-01-18 16:19:25 -0600 |
commit | 52476716ad2bff9805e5749bf2c2a1f9d3512ec9 (patch) | |
tree | 23552e2460dde4b509c22e22c9190bc4f65aeb2f /lib/lib.c | |
parent | d3e61fc8da81c38a82a02379397f513e99ba5249 (diff) | |
download | toybox-52476716ad2bff9805e5749bf2c2a1f9d3512ec9.tar.gz |
Add mkswap.
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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); |