summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fseek.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2001-09-01 15:28:24 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2001-09-01 15:28:24 +0000
commit35e1a550de699406e01db36552dbb4247a2bff94 (patch)
treeee54a20cc4f7b4c40b42a25070f3d75c3d0f8d9e /lib/libc/stdio/fseek.c
parentd911eb4536f396ee5f3b363607e19e0153b70e8b (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r--lib/libc/stdio/fseek.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index e83134732ac1..38a8bf5d6656 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -63,6 +63,7 @@ fseek(fp, offset, whence)
int whence;
{
int ret;
+ int serrno = errno;
/* make sure stdio is set up */
if (!__sdidinit)
@@ -71,6 +72,8 @@ fseek(fp, offset, whence)
FLOCKFILE(fp);
ret = _fseeko(fp, (off_t)offset, whence, 1);
FUNLOCKFILE(fp);
+ if (ret == 0)
+ errno = serrno;
return (ret);
}
@@ -81,6 +84,7 @@ fseeko(fp, offset, whence)
int whence;
{
int ret;
+ int serrno = errno;
/* make sure stdio is set up */
if (!__sdidinit)
@@ -89,6 +93,8 @@ fseeko(fp, offset, whence)
FLOCKFILE(fp);
ret = _fseeko(fp, offset, whence, 0);
FUNLOCKFILE(fp);
+ if (ret == 0)
+ errno = serrno;
return (ret);
}