diff options
author | 2019-06-28 13:32:41 +0000 | |
---|---|---|
committer | 2019-06-28 13:32:41 +0000 | |
commit | df69c215c7c66baf660f3f65414fd34796c96152 (patch) | |
tree | 0255639162b24c4a2f761a274e32b69c2256fd45 /lib/libc/stdio/fseek.c | |
parent | miniroot prototype disklabels should attempt to contain accurate (diff) | |
download | wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.tar.xz wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.zip |
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r-- | lib/libc/stdio/fseek.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c index f2e975df69e..1d0895a819a 100644 --- a/lib/libc/stdio/fseek.c +++ b/lib/libc/stdio/fseek.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fseek.c,v 1.12 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: fseek.c,v 1.13 2019/06/28 13:32:42 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -127,7 +127,7 @@ fseeko(FILE *fp, off_t offset, int whence) goto dumb; if ((fp->_flags & __SOPT) == 0) { if (seekfn != __sseek || - fp->_file < 0 || fstat(fp->_file, &st) || + fp->_file < 0 || fstat(fp->_file, &st) == -1 || (st.st_mode & S_IFMT) != S_IFREG) { fp->_flags |= __SNPT; goto dumb; @@ -143,7 +143,7 @@ fseeko(FILE *fp, off_t offset, int whence) if (whence == SEEK_SET) target = offset; else { - if (fstat(fp->_file, &st)) + if (fstat(fp->_file, &st) == -1) goto dumb; target = st.st_size + offset; } |