diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2004-05-03 20:17:59 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2004-05-03 20:17:59 +0000 |
commit | 1af84bb7f58c0aecfc1b5c6b6685e14afe36785e (patch) | |
tree | 231e4588fbf30b455a1c3c677ac87efeb61802e3 | |
parent | 1c63798e1d04d7926e9ee4cc66c401f7f6d36b37 (diff) | |
download | cygnal-1af84bb7f58c0aecfc1b5c6b6685e14afe36785e.tar.gz cygnal-1af84bb7f58c0aecfc1b5c6b6685e14afe36785e.tar.bz2 cygnal-1af84bb7f58c0aecfc1b5c6b6685e14afe36785e.zip |
2004-05-03 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/vfprintf.c (_VFPRINTF_R): Set error flag when
multibyte functions return failure for %C, %S, %lc, and %ls
format specifiers.
-rw-r--r-- | newlib/ChangeLog | 6 | ||||
-rw-r--r-- | newlib/libc/stdio/vfprintf.c | 22 |
2 files changed, 22 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index ff1e84407..f2c48cec5 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,5 +1,11 @@ 2004-05-03 Artem B. Bityuckiy <abitytsky@softminecorp.com> + * libc/stdio/vfprintf.c (_VFPRINTF_R): Set error flag when + multibyte functions return failure for %C, %S, %lc, and %ls + format specifiers. + +2004-05-03 Artem B. Bityuckiy <abitytsky@softminecorp.com> + * testsuite/include/check.h (CHECK): Add flush of stdout. 2004-05-03 Artem B. Bityuckiy <abitytsky@softminecorp.com> diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index ab40b2f6c..b72117582 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -762,8 +762,10 @@ reswitch: switch (ch) { memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); if ((size = (int)_wcrtomb_r (data, cp, (wchar_t)GET_ARG (N, ap, wint_t), - &ps)) == -1) + &ps)) == -1) { + fp->_flags |= __SERR; goto error; + } } else { *cp = GET_ARG (N, ap, int); @@ -942,8 +944,10 @@ reswitch: switch (ch) { if (wcp[m] == L'\0') break; if ((n = (int)_wcrtomb_r (data, - buf, wcp[m], &ps)) == -1) + buf, wcp[m], &ps)) == -1) { + fp->_flags |= __SERR; goto error; + } if (n + size > prec) break; m += 1; @@ -954,8 +958,10 @@ reswitch: switch (ch) { } else { if ((size = (int)_wcsrtombs_r (data, - NULL, &wcp, 0, &ps)) == -1) - goto error; + NULL, &wcp, 0, &ps)) == -1) { + fp->_flags |= __SERR; + goto error; + } wcp = (_CONST wchar_t *)cp; } @@ -963,14 +969,18 @@ reswitch: switch (ch) { break; if ((malloc_buf = - (char *)_malloc_r (data, size + 1)) == NULL) + (char *)_malloc_r (data, size + 1)) == NULL) { + fp->_flags |= __SERR; goto error; + } /* Convert widechar string to multibyte string. */ memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); if (_wcsrtombs_r (data, malloc_buf, - &wcp, size, &ps) != size) + &wcp, size, &ps) != size) { + fp->_flags |= __SERR; goto error; + } cp = malloc_buf; cp[size] = '\0'; } |