[pulseaudio-discuss] [PATCH v2] log: Fix compilation error on non-systemd systems

Ahmed S. Darwish darwish.07 at gmail.com
Wed Sep 16 14:38:38 PDT 2015


Commit 262bdae0330e used symbols which are only available if systemd
support was compiled in. Fix by using the appropriate #ifdef guards.

Also document the resulting PULSE_LOG_JOURNAL environment variable
behavior if systemd journal support was not compiled in.

Reported-by: David Henningsson <david.henningsson at canonical.com>
Signed-off-by: Ahmed S. Darwish <darwish.07 at gmail.com>
---
 src/pulse/pulseaudio.h | 4 +++-
 src/pulsecore/log.c    | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

[ v2: If we cannot inform the user at runtime, then let's at least
document our behavior ]

diff --git a/src/pulse/pulseaudio.h b/src/pulse/pulseaudio.h
index 5077e3b..ebf3ca1 100644
--- a/src/pulse/pulseaudio.h
+++ b/src/pulse/pulseaudio.h
@@ -147,7 +147,9 @@
  *     and function are included by default through the journal fields
  *     `CODE_FILE`, `CODE_FUNC`, and `CODE_LINE`. Any backtrace attached to
  *     the logging message is sent through the PulseAudio-specific journal
- *     field `PULSE_BACKTRACE`.
+ *     field `PULSE_BACKTRACE`. This environment variable has no effect if
+ *     systemd journal support was not compiled into your PulseAudio client
+ *     libraries.
  *  - `PULSE_LOG_COLORS`: If defined, enables colored logging output.
  *  - `PULSE_LOG_TIME`: If defined, include timestamps with each message.
  *  - `PULSE_LOG_FILE`: If defined, include each message originating file
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 34ed041..3c876f6 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -294,10 +294,12 @@ static void init_defaults(void) {
             target_override_set = true;
         }
 
+#ifdef HAVE_SYSTEMD_JOURNAL
         if (getenv(ENV_LOG_JOURNAL)) {
             target_override = PA_LOG_JOURNAL;
             target_override_set = true;
         }
+#endif
 
         if ((e = getenv(ENV_LOG_LEVEL))) {
             maximum_level_override = (pa_log_level_t) atoi(e);

-- 
Darwish
http://darwish.chasingpointers.com


More information about the pulseaudio-discuss mailing list