summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fseek.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2009-10-22 01:23:16 +0000
committerguenther <guenther@openbsd.org>2009-10-22 01:23:16 +0000
commit7ff09c5c6c97039a5c7f7864c46007f47d652b03 (patch)
tree85241012fd1c4ec9714f130877e15fb5088fd2d7 /lib/libc/stdio/fseek.c
parentAdd delete example since it has come up several times. (diff)
downloadwireguard-openbsd-7ff09c5c6c97039a5c7f7864c46007f47d652b03.tar.xz
wireguard-openbsd-7ff09c5c6c97039a5c7f7864c46007f47d652b03.zip
Back out previous commit, as it caused too much growth for the install
media to fit
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r--lib/libc/stdio/fseek.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index 525c095f895..98e95750879 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fseek.c,v 1.8 2009/10/21 16:04:23 guenther Exp $ */
+/* $OpenBSD: fseek.c,v 1.9 2009/10/22 01:23:16 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -70,7 +70,6 @@ fseeko(FILE *fp, off_t offset, int whence)
* Change any SEEK_CUR to SEEK_SET, and check `whence' argument.
* After this, whence is either SEEK_SET or SEEK_END.
*/
- FLOCKFILE(fp);
switch (whence) {
case SEEK_CUR:
@@ -84,10 +83,8 @@ fseeko(FILE *fp, off_t offset, int whence)
curoff = fp->_offset;
else {
curoff = (*seekfn)(fp->_cookie, (fpos_t)0, SEEK_CUR);
- if (curoff == (fpos_t)-1) {
- FUNLOCKFILE(fp);
+ if (curoff == (fpos_t)-1)
return (EOF);
- }
}
if (fp->_flags & __SRD) {
curoff -= fp->_r;
@@ -108,7 +105,6 @@ fseeko(FILE *fp, off_t offset, int whence)
break;
default:
- FUNLOCKFILE(fp);
errno = EINVAL;
return (EOF);
}
@@ -193,7 +189,6 @@ fseeko(FILE *fp, off_t offset, int whence)
if (HASUB(fp))
FREEUB(fp);
fp->_flags &= ~__SEOF;
- FUNLOCKFILE(fp);
return (0);
}
@@ -220,7 +215,6 @@ fseeko(FILE *fp, off_t offset, int whence)
fp->_p += n;
fp->_r -= n;
}
- FUNLOCKFILE(fp);
return (0);
/*
@@ -230,7 +224,6 @@ fseeko(FILE *fp, off_t offset, int whence)
dumb:
if (__sflush(fp) ||
(*seekfn)(fp->_cookie, (fpos_t)offset, whence) == POS_ERR) {
- FUNLOCKFILE(fp);
return (EOF);
}
/* success: clear EOF indicator and discard ungetc() data */
@@ -240,7 +233,6 @@ dumb:
fp->_r = 0;
/* fp->_w = 0; */ /* unnecessary (I think...) */
fp->_flags &= ~__SEOF;
- FUNLOCKFILE(fp);
return (0);
}