[pulseaudio-discuss] [PATCH] core: add more verbose error info

Deng Zhengrong dzrongg at gmail.com
Mon Jul 9 17:32:54 PDT 2012


I'm debugging an issue, and find that it's more useful for users to know which
directory hasn't been created instead of just knowing error code.
---
 src/pulsecore/core-util.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index e435cc4..9b05c4f 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1508,7 +1508,7 @@ char *pa_get_state_dir(void) {
      * dir then this will break. */
 
     if (pa_make_secure_dir(d, 0700U, (uid_t) -1, (gid_t) -1, TRUE) < 0) {
-        pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno));
+        pa_log_error("Failed to create secure directory(%s): %s", d, pa_cstrerror(errno));
         pa_xfree(d);
         return NULL;
     }
@@ -1650,7 +1650,7 @@ char *pa_get_runtime_dir(void) {
     if (d) {
 
         if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1, TRUE) < 0) {
-            pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno));
+            pa_log_error("Failed to create secure directory(%s): %s", d, pa_cstrerror(errno));
             goto fail;
         }
 
@@ -1664,7 +1664,7 @@ char *pa_get_runtime_dir(void) {
 
         if (pa_make_secure_dir(k, m, (uid_t) -1, (gid_t) -1, TRUE) < 0) {
             free(k);
-            pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno));
+            pa_log_error("Failed to create secure directory(%s): %s", k, pa_cstrerror(errno));
             goto fail;
         }
 
@@ -1677,7 +1677,7 @@ char *pa_get_runtime_dir(void) {
         goto fail;
 
     if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1, TRUE) < 0) {
-        pa_log_error("Failed to create secure directory: %s", pa_cstrerror(errno));
+        pa_log_error("Failed to create secure directory(%s): %s", d, pa_cstrerror(errno));
         pa_xfree(d);
         goto fail;
     }
-- 
1.7.7.6



More information about the pulseaudio-discuss mailing list