core: Slightly more helpful pa_cstrerror for unknown errors

On Windows, strerror can actually return "Unknown Error"
(e.g. for large errnums). The code assumes the return value to be helpful.
Make it slightly more helpful by catching the message and appending the
errnum.
This commit is contained in:
Thomas Martitz 2012-08-20 23:50:39 +02:00 committed by Arun Raghavan
parent b342daded9
commit 9f3bba8bd4

View file

@ -63,8 +63,9 @@ const char* pa_cstrerror(int errnum) {
original = strerror(errnum);
#endif
if (!original) {
pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %i", errnum);
/* The second condition is a Windows-ism */
if (!original || !strcasecmp(original, "Unknown error")) {
pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %d", errnum);
original = errbuf;
}