diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-08-20 23:50:39 +0200 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2012-10-23 12:16:50 +0530 |
commit | 9f3bba8bd4c5c5bfeaf22d2d314efba2f3f0b065 (patch) | |
tree | 7056c79e971055adfe26da2c194587f431a11157 | |
parent | b342daded9f3eed967637bc32ae066bce827c81d (diff) | |
download | pulseaudio-9f3bba8bd4c5c5bfeaf22d2d314efba2f3f0b065.tar.gz |
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.
-rw-r--r-- | src/pulsecore/core-error.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pulsecore/core-error.c b/src/pulsecore/core-error.c index 4d930a090..a1aee0e87 100644 --- a/src/pulsecore/core-error.c +++ b/src/pulsecore/core-error.c @@ -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; } |