On 02/09/2011 05:48 PM, Eric Blake wrote: > POSIX requires that this program have an identical first and last line: > > #include <stdio.h> > #include <string.h> > #include <errno.h> > int main (void) { > char *err = strerror(1000); > printf ("%s\n", err); > errno = 2000; > perror ("hi"); > printf ("%s\n", err); > return 0; > } > > but on cygwin 1.7.7, the perror() corrupts the buffer returned by > strerror(). We should probably fix that in gnulib as part of our perror > module.
Actually, maybe the fix to this is to make sure that we always replace strerror(), and strcpy() the output into a secondary buffer (other libc functions that incorrectly call strerror() will not overwrite our secondary buffer), and make sure that the rest of gnulib uses only strerror_r() rather than strerror() (although that means making more modules dependent on strerror_r-posix, such as perror). -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature