Skip to content
Snippets Groups Projects
Commit 35ce994c authored by Simon McVittie's avatar Simon McVittie
Browse files

run-outside-ldlp: Do basic logging initialization before parsing arguments


_srt_log_failure() uses a custom log level that is understood by our
log handler, so it doesn't work until we have set our log handler,
which we do the first time _srt_util_set_glib_log_handler() is called.
If we fail and early-return before the log handler is set, that leads
to errors being reported strangely:

    $ srt-run-outside-ldlp --wrong
    steam-runtime-tools-LOG-0x100: 21:28:47.912: Unknown option --wrong

Not setting the program name also meant that we'd log as `(null)`,
for example:

    (null)[12345]: I: Found 'cat' at /usr/bin/cat

or possibly crash if somehow run with a less tolerant libc.

Fixes: ecaade46 "run-outside-ldlp: Add new tool for escaping the LDLP runtime"
Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 20a723a7
No related branches found
No related tags found
1 merge request!753run-outside-ldlp: Do basic logging initialization before parsing arguments
Pipeline #99202 passed
......@@ -55,6 +55,11 @@ run (int argc,
glnx_autofd int original_stdout = -1;
glnx_autofd int original_stderr = -1;
if (!_srt_util_set_glib_log_handler (THIS_PROGRAM,
G_LOG_DOMAIN, SRT_LOG_FLAGS_NONE,
NULL, NULL, error))
return FALSE;
exe_name = glnx_basename (argv[0]);
if (g_str_equal (exe_name, THIS_PROGRAM))
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment