aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-05-15 17:48:43 -0700
committerH. Peter Anvin <hpa@zytor.com>2012-05-15 17:48:43 -0700
commitb8a4fc979849e4470bf31306575a0b0478a6043e (patch)
treee3e5c1e44c580ce5ea32f2b56e47af12e83d955d
parentb0abe7cd311cba23a960d62d0abed91f798710d2 (diff)
downloadklibc-b8a4fc979849e4470bf31306575a0b0478a6043e.tar.gz
klibc: fseek: use >= 0 to test for lseek() success
On Linux, at least, lseek() will never return a negative value on success; on some architectures comparing against zero is smaller. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--usr/klibc/stdio/fseek.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr/klibc/stdio/fseek.c b/usr/klibc/stdio/fseek.c
index fe6aeab5a961d..e35f85e64a632 100644
--- a/usr/klibc/stdio/fseek.c
+++ b/usr/klibc/stdio/fseek.c
@@ -17,7 +17,7 @@ __extern int fseek(FILE *file, off_t where, int whence)
where -= f->ibytes;
rv = lseek(f->pub._IO_fileno, where, whence);
- if (__likely(rv != (off_t)-1)) {
+ if (__likely(rv >= 0)) {
f->pub._IO_eof = false;
f->ibytes = 0;
return 0;