[pulseaudio-discuss] [PATCH v3 6/6] Windows/pa_cstrerror(): Slightly more helpful unknown error.

Thomas Martitz kugel at rockbox.org
Mon Aug 20 15:04:19 PDT 2012


From: Thomas Martitz <kuge at rockbox.org>

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