On 10/15/2011 03:49 AM, Bruno Haible wrote:
Hi Eric,

Daniel Richard G. wrote:
* "checking whether perror matches strerror": strerror(-1) returns
   an invalid pointer, and attempting to puts() this yields SIGBUS.
   (Wouldn't it be safer to pass EPERM or something similarly
   universal?)

This is the purpose of the test: testing whether you can safely pass
invalid error number, such as -1, to strerror.

I thought it was to test that perror() and strerror() gave the
same output.

Note that currently, the test passes despite the SIGBUS. It should
probably check that $? = 0 before comparing stdout vs. stderr.

I'm not sure. This test is about perror(). Should it fail just because
strerror returns an invalid pointer? Eric, what do you think?

perror() is required to give output containing the same string as strerror, and strerror() is required to give a valid string (possible "") on all values, including -1. Since -1 gives SIGBUS, then both strerror and perror need to be replaced on this platform, and the test needs to be fixed to recognize that a test that dies from a signal indicates failure.

--
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to