This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fix fgetwc() from unbuffered file (RH bug 457506)


Hi,

This is a fix for this RH bug:

https://bugzilla.redhat.com/show_bug.cgi?id=457506

Testcase:

This what is working for me with this patch:

#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!



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]