summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2015-11-12 22:24:39 +0000
committerache <ache@FreeBSD.org>2015-11-12 22:24:39 +0000
commitd484c089b5df6284949d1415484a475b33aadefa (patch)
tree982d0f7bf65ac2dd6e672ffa3be8678b38d90fe5 /lib/libc
parentc1d9f70889401a68e5b3d9d51b1bc7fe699389ae (diff)
downloadFreeBSD-src-d484c089b5df6284949d1415484a475b33aadefa.zip
FreeBSD-src-d484c089b5df6284949d1415484a475b33aadefa.tar.gz
1) Remove my overcomplicated error fallback and just return error
immediatelly as old code does, now for append modes too. Real use case for such fallback is impossible (unless specially crafted). 2) Remove now unneded include I forgot to remove in prev. commits. MFC after: 1 week
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/ftell.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c
index f0e244b..fc792af 100644
--- a/lib/libc/stdio/ftell.c
+++ b/lib/libc/stdio/ftell.c
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/types.h>
#include <errno.h>
-#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include "un-namespace.h"
@@ -101,16 +100,9 @@ _ftello(FILE *fp, fpos_t *offset)
if (!(fp->_flags & __SRD) && (fp->_flags & __SWR) &&
fp->_p != NULL && fp->_p - fp->_bf._base > 0 &&
((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP))) {
- if ((pos = _sseek(fp, (fpos_t)0, SEEK_END)) == -1) {
- if (errno == ESPIPE ||
- (fp->_flags & __SOPT) || __sflush(fp) ||
- (pos = _sseek(fp, (fpos_t)0, SEEK_CUR)) == -1)
- return (1);
- else {
- *offset = pos;
- return (0);
- }
- }
+ pos = _sseek(fp, (fpos_t)0, SEEK_END);
+ if (pos == -1)
+ return (1);
} else if (fp->_flags & __SOFF)
pos = fp->_offset;
else {
OpenPOWER on IntegriCloud