'Twas brillig, and Vincent Becker at 24/03/11 10:35 did gyre and gimble:
> Replace wrong implementation of log to file in pa_daemon_conf_set_log_level 
> to pa_daemon_conf_set_log_target

Sorry but this is not based on git master.... (as Maarten asked for before).

[colin@jimmy pulseaudio (master|AM)]$ cat ~/Download/pa.patch | patch
-p1 --dry-run
patching file src/daemon/daemon-conf.c
Hunk #1 FAILED at 142.
Hunk #2 FAILED at 170.
Hunk #3 succeeded at 187 (offset -5 lines).
Hunk #4 FAILED at 235.
3 out of 4 hunks FAILED -- saving rejects to file
src/daemon/daemon-conf.c.rej

I think it's just a matter of ignoring hunks 1 & 2 anyway (as I already
made that change when I committed the original version) and the move
from 4 to 3 should just be updated as the code in hunk 4 was updated
(tho' the newer code is the same as you put in in your hunk 3).

IOW, feel free to update your patch, or alternatively, I can just commit
what I have..... (straight move of the code) which I've attached. Let me
know if it's OK.


Cheers

Col

PS, kinda embarrassed I missed this glaring error first time round :D



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]
From 97ca39bd478250b423f1cefdabe757997b6e4459 Mon Sep 17 00:00:00 2001
From: Vincent Becker <vincentx.bec...@intel.com>
Date: Thu, 24 Mar 2011 11:35:02 +0100
Subject: [PATCH] log: Correct bad function implementation

Replace wrong implementation of log to file in pa_daemon_conf_set_log_level to 
pa_daemon_conf_set_log_target
---
 src/daemon/daemon-conf.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 2872c74..30bea24 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -187,6 +187,22 @@ int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const 
char *string) {
     } else if (!strcmp(string, "stderr")) {
         c->auto_log_target = 0;
         c->log_target = PA_LOG_STDERR;
+    } else if (pa_startswith(string, "file:")) {
+        char file_path[512];
+        int log_fd;
+
+        pa_strlcpy(file_path, string + 5, sizeof(file_path));
+
+        /* Open target file with user rights */
+        if ((log_fd = open(file_path, O_RDWR|O_TRUNC|O_CREAT, S_IRWXU)) >= 0) {
+             c->auto_log_target = 0;
+             c->log_target = PA_LOG_FD;
+             pa_log_set_fd(log_fd);
+        }
+        else {
+            printf("Failed to open target file %s, error : %s\n", file_path, 
pa_cstrerror(errno));
+            return -1;
+        }
     } else
         return -1;
 
@@ -213,23 +229,6 @@ int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const 
char *string) {
         c->log_level = PA_LOG_WARN;
     else if (pa_startswith(string, "err"))
         c->log_level = PA_LOG_ERROR;
-    else if (pa_startswith(string, "file:")) {
-        char file_path[512];
-        int log_fd;
-
-        pa_strlcpy(file_path, string + 5, sizeof(file_path));
-
-        /* Open target file with user rights */
-        if ((log_fd = open(file_path, O_RDWR|O_TRUNC|O_CREAT, S_IRWXU)) >= 0) {
-             c->auto_log_target = 0;
-             c->log_target = PA_LOG_FD;
-             pa_log_set_fd(log_fd);
-        }
-        else {
-            printf("Failed to open target file %s, error : %s\n", file_path, 
pa_cstrerror(errno));
-            return -1;
-        }
-    }
     else
         return -1;
 
-- 
1.7.4.1

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to