mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-16 02:41:07 +02:00
Merge branch 'wip/smcv/gio-launch-desktop-sd-journal' into 'main'
gio-launch-desktop: Only replace fds that point to the Journal See merge request GNOME/glib!2836
This commit is contained in:
commit
f2aeba9a08
@ -187,11 +187,16 @@ fail:
|
|||||||
static void
|
static void
|
||||||
set_up_journal (const char *argv1)
|
set_up_journal (const char *argv1)
|
||||||
{
|
{
|
||||||
|
int stdout_is_journal;
|
||||||
|
int stderr_is_journal;
|
||||||
const char *identifier;
|
const char *identifier;
|
||||||
const char *slash;
|
const char *slash;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (!_g_fd_is_journal (STDOUT_FILENO) && !_g_fd_is_journal (STDERR_FILENO))
|
stdout_is_journal = _g_fd_is_journal (STDOUT_FILENO);
|
||||||
|
stderr_is_journal = _g_fd_is_journal (STDERR_FILENO);
|
||||||
|
|
||||||
|
if (!stdout_is_journal && !stderr_is_journal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
identifier = getenv ("GIO_LAUNCHED_DESKTOP_FILE");
|
identifier = getenv ("GIO_LAUNCHED_DESKTOP_FILE");
|
||||||
@ -210,14 +215,14 @@ set_up_journal (const char *argv1)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dup2 (fd, STDOUT_FILENO) != STDOUT_FILENO)
|
if (stdout_is_journal && dup2 (fd, STDOUT_FILENO) != STDOUT_FILENO)
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"gio-launch-desktop[%d]: Unable to redirect \"%s\" to Journal: %s",
|
"gio-launch-desktop[%d]: Unable to redirect \"%s\" to Journal: %s",
|
||||||
getpid (),
|
getpid (),
|
||||||
identifier,
|
identifier,
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
|
|
||||||
if (dup2 (fd, STDERR_FILENO) != STDERR_FILENO)
|
if (stderr_is_journal && dup2 (fd, STDERR_FILENO) != STDERR_FILENO)
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"gio-launch-desktop[%d]: Unable to redirect \"%s\" to Journal: %s",
|
"gio-launch-desktop[%d]: Unable to redirect \"%s\" to Journal: %s",
|
||||||
getpid (),
|
getpid (),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user