[glib: 9/10] gio-launch-desktop: Don't alter stdout/stderr if not already the Journal




commit f73641482586bd3e49b73067569aa79ecd56aa5d
Author: Simon McVittie <smcv collabora com>
Date:   Thu Jul 14 14:30:30 2022 +0100

    gio-launch-desktop: Don't alter stdout/stderr if not already the Journal
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 gio/gio-launch-desktop.c | 5 +++++
 gio/meson.build          | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gio/gio-launch-desktop.c b/gio/gio-launch-desktop.c
index 1af25e739e..9ed6712f74 100644
--- a/gio/gio-launch-desktop.c
+++ b/gio/gio-launch-desktop.c
@@ -47,6 +47,8 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#include "gjournal-private.h"
+
 /*
  * write_all:
  * @fd: a file descriptor
@@ -189,6 +191,9 @@ set_up_journal (const char *argv1)
   const char *slash;
   int fd;
 
+  if (!_g_fd_is_journal (STDOUT_FILENO) && !_g_fd_is_journal (STDERR_FILENO))
+    return;
+
   identifier = getenv ("GIO_LAUNCHED_DESKTOP_FILE");
 
   if (identifier == NULL)
diff --git a/gio/meson.build b/gio/meson.build
index 9557464e8e..69bb0603eb 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -400,8 +400,14 @@ if host_system != 'windows'
     contenttype_sources += files('gcontenttype.c')
     appinfo_sources += files('gdesktopappinfo.c')
     gio_unix_include_headers += files('gdesktopappinfo.h')
+    launch_desktop_sources = files('gio-launch-desktop.c')
 
-    gio_launch_desktop = executable('gio-launch-desktop', 'gio-launch-desktop.c',
+    if host_system == 'linux'
+      launch_desktop_sources += files('../glib/gjournal-private.c')
+    endif
+
+    gio_launch_desktop = executable('gio-launch-desktop', launch_desktop_sources,
+      include_directories : glibinc,
       install : true,
       install_dir : multiarch_libexecdir,
       c_args : gio_c_args,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]