summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-07-20 21:24:29 +0000
committerpfg <pfg@FreeBSD.org>2014-07-20 21:24:29 +0000
commit4116752e681819b04fba157cf62b81c7432011ee (patch)
tree7c1f5231a148a0b9e1489646eb32f94be3a5e8b7 /lib/libc/stdio/vfprintf.c
parentd83317ec90360b529ba9e0ef55d6a089c2a0dfac (diff)
downloadFreeBSD-src-4116752e681819b04fba157cf62b81c7432011ee.zip
FreeBSD-src-4116752e681819b04fba157cf62b81c7432011ee.tar.gz
Adjust errno on failed prepwrite.
Obtained from: Apple Inc. (Libc 997.90.3) Phabric: D442 MFC after: 1 week
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index ea47d36..e54e8ac 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -455,8 +455,10 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0, va_list ap)
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;
OpenPOWER on IntegriCloud