[pulseaudio-discuss] [PATCH v2 6/6] Windows/pa_cstrerror(): Slightly more helpful unknown error.
Thomas Martitz
kugel at rockbox.org
Mon Aug 20 14:50:39 PDT 2012
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.
---
src/pulsecore/core-error.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pulsecore/core-error.c b/src/pulsecore/core-error.c
index 4d930a0..257573e 100644
--- a/src/pulsecore/core-error.c
+++ b/src/pulsecore/core-error.c
@@ -63,8 +63,8 @@ const char* pa_cstrerror(int errnum) {
original = strerror(errnum);
#endif
- if (!original) {
- pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %i", errnum);
+ if (!original || !strcasecmp(original, "Unknown error")) {
+ pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %d", errnum);
original = errbuf;
}
--
1.7.10.4
More information about the pulseaudio-discuss
mailing list