Some programs start with the path and command line arguments in argv[0] (program_invocation_name). Chromium is an example of an application using mesa that does this.
This tries to query the real path for the symbolic link /proc/self/exe to find the program name instead. Signed-off-by: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com> --- src/util/u_process.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/util/u_process.c b/src/util/u_process.c index 5e5927678d..4cae6f6dee 100644 --- a/src/util/u_process.c +++ b/src/util/u_process.c @@ -41,8 +41,22 @@ static const char * __getProgramName() { char * arg = strrchr(program_invocation_name, '/'); - if (arg) + if (arg) { + /* This is likely part of a Linux file path. + * Try to get the program name without any command line arguments. */ + static char * full_path; + + if (!full_path) + full_path = realpath("/proc/self/exe", NULL); + + if (full_path) { + char * res = strrchr(full_path, '/'); + if (res) + return res+1; + } + return arg+1; + } /* If there was no '/' at all we likely have a windows like path from * a wine application. -- 2.19.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev