mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-07 12:08:13 +02:00
Set argv[0] to dbus-launch to avoid misleading info from /proc
At previous, argv[0] is the full-qualified path of program, however, if start dbus-launch failed, it will fall back to find one from $PATH, while keep the argv[0] as the full-qualified path. So we'll get misleading info from /proc or ps(1) about dbus-launch process. One simple solution is just hard-code argv[0] to dbus-launch. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69716 Reviewed-by: Simon McVittie
This commit is contained in:
parent
9383a02274
commit
3e5b148dcd
1 changed files with 11 additions and 4 deletions
|
|
@ -3494,6 +3494,7 @@ _dbus_get_autolaunch_address (const char *scope,
|
||||||
* but that's done elsewhere, and if it worked, this function wouldn't
|
* but that's done elsewhere, and if it worked, this function wouldn't
|
||||||
* be called.) */
|
* be called.) */
|
||||||
const char *display;
|
const char *display;
|
||||||
|
char *progpath;
|
||||||
char *argv[6];
|
char *argv[6];
|
||||||
int i;
|
int i;
|
||||||
DBusString uuid;
|
DBusString uuid;
|
||||||
|
|
@ -3533,13 +3534,19 @@ _dbus_get_autolaunch_address (const char *scope,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
|
||||||
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
|
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
|
||||||
if (_dbus_getenv ("DBUS_USE_TEST_BINARY") != NULL)
|
if (_dbus_getenv ("DBUS_USE_TEST_BINARY") != NULL)
|
||||||
argv[i] = TEST_BUS_LAUNCH_BINARY;
|
progpath = TEST_BUS_LAUNCH_BINARY;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
argv[i] = DBUS_BINDIR "/dbus-launch";
|
progpath = DBUS_BINDIR "/dbus-launch";
|
||||||
|
/*
|
||||||
|
* argv[0] is always dbus-launch, that's the name what we'll
|
||||||
|
* get from /proc, or ps(1), regardless what the progpath is,
|
||||||
|
* see fd.o#69716
|
||||||
|
*/
|
||||||
|
i = 0;
|
||||||
|
argv[i] = "dbus-launch";
|
||||||
++i;
|
++i;
|
||||||
argv[i] = "--autolaunch";
|
argv[i] = "--autolaunch";
|
||||||
++i;
|
++i;
|
||||||
|
|
@ -3554,7 +3561,7 @@ _dbus_get_autolaunch_address (const char *scope,
|
||||||
|
|
||||||
_dbus_assert (i == _DBUS_N_ELEMENTS (argv));
|
_dbus_assert (i == _DBUS_N_ELEMENTS (argv));
|
||||||
|
|
||||||
retval = _read_subprocess_line_argv (argv[0],
|
retval = _read_subprocess_line_argv (progpath,
|
||||||
TRUE,
|
TRUE,
|
||||||
argv, address, error);
|
argv, address, error);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue