From owner-svn-src-head@FreeBSD.ORG Sun Jul 20 21:24:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5705669E; Sun, 20 Jul 2014 21:24:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A2FF2D62; Sun, 20 Jul 2014 21:24:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6KLOUC4083882; Sun, 20 Jul 2014 21:24:30 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6KLOTKk083874; Sun, 20 Jul 2014 21:24:29 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201407202124.s6KLOTKk083874@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 20 Jul 2014 21:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268930 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2014 21:24:30 -0000 Author: pfg Date: Sun Jul 20 21:24:29 2014 New Revision: 268930 URL: http://svnweb.freebsd.org/changeset/base/268930 Log: Adjust errno on failed prepwrite. Obtained from: Apple Inc. (Libc 997.90.3) Phabric: D442 MFC after: 1 week Modified: head/lib/libc/stdio/vfprintf.c head/lib/libc/stdio/vfwprintf.c head/lib/libc/stdio/wbuf.c Modified: head/lib/libc/stdio/vfprintf.c ============================================================================== --- head/lib/libc/stdio/vfprintf.c Sun Jul 20 21:02:35 2014 (r268929) +++ head/lib/libc/stdio/vfprintf.c Sun Jul 20 21:24:29 2014 (r268930) @@ -455,8 +455,10 @@ __vfprintf(FILE *fp, locale_t locale, co return (__xvprintf(fp, fmt0, ap)); /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */ - if (prepwrite(fp) != 0) + if (prepwrite(fp) != 0) { + errno = EBADF; return (EOF); + } convbuf = NULL; fmt = (char *)fmt0; Modified: head/lib/libc/stdio/vfwprintf.c ============================================================================== --- head/lib/libc/stdio/vfwprintf.c Sun Jul 20 21:02:35 2014 (r268929) +++ head/lib/libc/stdio/vfwprintf.c Sun Jul 20 21:24:29 2014 (r268930) @@ -531,8 +531,10 @@ __vfwprintf(FILE *fp, locale_t locale, c /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */ - if (prepwrite(fp) != 0) + if (prepwrite(fp) != 0) { + errno = EBADF; return (EOF); + } convbuf = NULL; fmt = (wchar_t *)fmt0; Modified: head/lib/libc/stdio/wbuf.c ============================================================================== --- head/lib/libc/stdio/wbuf.c Sun Jul 20 21:02:35 2014 (r268929) +++ head/lib/libc/stdio/wbuf.c Sun Jul 20 21:24:29 2014 (r268930) @@ -36,6 +36,7 @@ static char sccsid[] = "@(#)wbuf.c 8.1 ( #include __FBSDID("$FreeBSD$"); +#include #include #include "local.h" @@ -59,8 +60,10 @@ __swbuf(int c, FILE *fp) * calls might wrap _w from negative to positive. */ fp->_w = fp->_lbfsize; - if (prepwrite(fp) != 0) + if (prepwrite(fp) != 0) { + errno = EBADF; return (EOF); + } c = (unsigned char)c; ORIENT(fp, -1);