Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jul 2014 16:10:56 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268983 - head/lib/libc/stdio
Message-ID:  <201407221610.s6MGAugj065254@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Jul 22 16:10:56 2014
New Revision: 268983
URL: http://svnweb.freebsd.org/changeset/base/268983

Log:
  rewind: always clear error indicator.
  
  Required by POSIX:
  http://pubs.opengroup.org/onlinepubs/009695399/functions/rewind.html
  
  Obtained from:	Apple Inc. (Libc 997.90.3)
  MFC after:	1 week

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

Modified: head/lib/libc/stdio/rewind.c
==============================================================================
--- head/lib/libc/stdio/rewind.c	Tue Jul 22 13:58:33 2014	(r268982)
+++ head/lib/libc/stdio/rewind.c	Tue Jul 22 16:10:56 2014	(r268983)
@@ -53,9 +53,8 @@ rewind(FILE *fp)
 		__sinit();
 
 	FLOCKFILE(fp);
-	if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) {
-		clearerr_unlocked(fp);
+	if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0)
 		errno = serrno;
-	}
+	clearerr_unlocked(fp);	/* POSIX: clear stdio error regardless */
 	FUNLOCKFILE(fp);
 }



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