On 04/24/2018 10:40 AM, Eric Blake wrote: > On 04/24/2018 10:18 AM, Daniel P. Berrangé wrote: > >>> - static void vreport(report_type type, const char *fmt, va_list ap) >>> + static void vreport(report_type type, int errnoval, const char *fmt, va_list ap) >>> ... >>> + if (errnoval >= 0) { >>> + error_printf(": %s", strerror(errnoval); >>> + } >>> >>> and then add both >>> error_report_errno >>> error_vreport_errno >>> with the obvious semantics. >> >> That would be nice, because then we can make these two functions actually >> use strerror_r() instead of strerror(), for thread safety on all platforms. > > Except that strerror_r() is a bear to use portably, given that glibc's > default declaration differs from the POSIX requirement (you can force > glibc to give you the POSIX version, but doing so causes you to lose > access to many other useful extensions). It's rather telling that 'git > grep strerror_r' currently comes up empty. That said, glib's g_strerror() may be suitable for this purpose, although we are currently using it only in tests/ivshmem-test.c. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org