From ede3fe6c94a1fc8b38ad524d878c1b0a4a3593a0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 7 Oct 2007 22:43:41 +0000 Subject: [PATCH] POSIX functions return their error codes via errno and so does lseek(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22479 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/unistd/lseek.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/posix/unistd/lseek.c b/src/system/libroot/posix/unistd/lseek.c index a871bfd510..acf14ec27e 100644 --- a/src/system/libroot/posix/unistd/lseek.c +++ b/src/system/libroot/posix/unistd/lseek.c @@ -4,11 +4,19 @@ */ #include + +#include + #include off_t lseek(int fd, off_t pos, int whence) { - return _kern_seek(fd, pos, whence); + off_t result = _kern_seek(fd, pos, whence); + if (result < 0) { + errno = result; + return -1; + } + return result; }