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.
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;
}