This patch fixes a warning "variable 'wc' set but not used" in
libio/bug-ungetwc1.c.
The test didn't verify much about the results of the functions it
called. This patch makes it check the result of getwc (thereby fixing
the warning), check end of file does not arrive too late in the getwc
loop, and check EOF is no longer set after ungetwc.
Tested for x86_64.
* libio/bug-ungetwc1.c (do_test): Verify results of getwc and
feof.
* libio/bug-ungetwc1.c: New file.
* libio/Makefile (tests): Add bug-ungetwc1.
* libio/fileops.c (_IO_new_file_close_it): Only call _IO_do_flush
if stream was last used for writing.