Date: Sun, 20 Jul 2014 21:24:29 +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: r268930 - head/lib/libc/stdio Message-ID: <201407202124.s6KLOTKk083874@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <errno.h> #include <stdio.h> #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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407202124.s6KLOTKk083874>