Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Nov 2015 22:24:39 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r290729 - head/lib/libc/stdio
Message-ID:  <201511122224.tACMOdUc000321@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ache
Date: Thu Nov 12 22:24:39 2015
New Revision: 290729
URL: https://svnweb.freebsd.org/changeset/base/290729

Log:
  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

Modified:
  head/lib/libc/stdio/ftell.c

Modified: head/lib/libc/stdio/ftell.c
==============================================================================
--- head/lib/libc/stdio/ftell.c	Thu Nov 12 22:00:59 2015	(r290728)
+++ head/lib/libc/stdio/ftell.c	Thu Nov 12 22:24:39 2015	(r290729)
@@ -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 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511122224.tACMOdUc000321>