Module Name: src
Committed By: yamt
Date: Mon Jan 20 14:11:03 UTC 2014
Modified Files:
src/lib/libc/stdio: vfwprintf.c
Log Message:
vfwprintf: fix error propagation
PR/47660 (Julio Merino)
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/stdio/vfwprintf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdio/vfwprintf.c
diff -u src/lib/libc/stdio/vfwprintf.c:1.33 src/lib/libc/stdio/vfwprintf.c:1.34
--- src/lib/libc/stdio/vfwprintf.c:1.33 Mon Sep 23 12:41:37 2013
+++ src/lib/libc/stdio/vfwprintf.c Mon Jan 20 14:11:03 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: vfwprintf.c,v 1.33 2013/09/23 12:41:37 pooka Exp $ */
+/* $NetBSD: vfwprintf.c,v 1.34 2014/01/20 14:11:03 yamt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -38,7 +38,7 @@
static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
__FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.27 2007/01/09 00:28:08 imp Exp $");
#else
-__RCSID("$NetBSD: vfwprintf.c,v 1.33 2013/09/23 12:41:37 pooka Exp $");
+__RCSID("$NetBSD: vfwprintf.c,v 1.34 2014/01/20 14:11:03 yamt Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -712,7 +712,10 @@ WDECL(__vf,printf_unlocked_l)(FILE *fp,
#ifndef NARROW
#define PRINT(ptr, len) do { \
for (n3 = 0; n3 < (len); n3++) \
- __xfputwc((ptr)[n3], fp, loc); \
+ if (__xfputwc((ptr)[n3], fp, loc) == END_OF_FILE) { \
+ fp->_flags |= __SERR; \
+ goto error; \
+ } \
} while (/*CONSTCOND*/0)
#define FLUSH()
#else