[PATCH] fix fgetwc() from unbuffered file (RH bug 457506)
Denys Vlasenko
dvlasenk@redhat.com
Thu Aug 28 12:44:00 GMT 2008
On Wed, 2008-08-27 at 12:13 +0200, Denys Vlasenko wrote:
> Hi,
>
> This is a fix for this RH bug:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=457506
>
> Testcase:
>
> #include <stdio.h>
> #include <locale.h>
> #include <wchar.h>
> int main(void)
> {
> wint_t c;
> setlocale(LC_ALL, "en_US.utf8");
> setvbuf(stdin, NULL, _IONBF, 0);
> while ((c = fgetwc(stdin)) != WEOF) {
> fputwc(c, stdout);
> fflush(stdout);
> }
> if (ferror(stdin))
> perror(NULL);
> }
>
> # cat zz.txt
> qwerty
> йÑÑкен
>
> # LD_LIBRARY_PATH=. ./a.out <zz.txt
> qwerty
> йÑÑкен <--- without patch, this is not printed!
>
Oops.. forgot the patch itself :(
Please find attached.
for Changelog:
2008-08-27 Denys Vlasenko <dvlasenk@redhat.com>
* libio/wfileops.c (_IO_wfile_underflow): Use local small
buffer if input file is unbuffered.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_rhbug457506-2.patch
Type: text/x-patch
Size: 2698 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20080828/c45fed6b/attachment.bin>
More information about the Libc-alpha
mailing list