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); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"