On 09/26/2011 04:17 PM, Bruno Haible wrote:
Paolo Bonzini asked:
* modules/fclose-tests (Depends-on): Add fdopen.
* modules/fflush-tests (Depends-on): Likewise.
* modules/fgetc-tests (Depends-on): Likewise.
* modules/fputc-tests (Depends-on): Likewise.
* modules/fread-tests (Depends-on): Likewise.
* modules/freopen-tests (Depends-on): Likewise.
* modules/fseeko-tests (Depends-on): Likewise.
* modules/ftello-tests (Depends-on): Likewise.
* modules/fwrite-tests (Depends-on): Likewise.
Why?
These tests (test-fgetc.c etc.) call fdopen (-1, "r"), which is supposed
to return NULL / EBADF. But -- see doc/posix-functions/fdopen.texi --
this call crashes on MSVC 9, and the gnulib 'fdopen' module provides the
workaround (through an invalid parameter handler that prevents the crash).
If fdopen(-1,"r") returns anything besides NULL in the first place, then
that is a bug in fdopen(). It looks like you are doing some bogus
testing in these various files:
/* Test that fclose() sets errno if the stream was constructed with
an invalid file descriptor. */
{
FILE *fp = fdopen (-1, "r");
if (fp != NULL)
{
errno = 0;
ASSERT (fclose (fp) == EOF);
ASSERT (errno == EBADF);
}
}
since fp should be NULL at this point, and thus a compliant system won't
be testing fclose() behavior in the first place.
--
Eric Blake ebl...@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org