From 2dfd2e5eaf4255c8660000f3076ef95e83c05475 Mon Sep 17 00:00:00 2001 From: grialion <48643945+grialion@users.noreply.github.com> Date: Fri, 16 Jan 2026 21:38:43 +0100 Subject: [PATCH] fix(desktop_exec): skip resolving absolute paths Previously it'd try to find the absolute binary path in the path env. --- src/desktop_exec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/desktop_exec.c b/src/desktop_exec.c index 1cbae04..b8d1c9a 100644 --- a/src/desktop_exec.c +++ b/src/desktop_exec.c @@ -18,6 +18,10 @@ // returns NULL on any error // otherwise it returns the absolute path of the program that MUST BE FREED static char* NULLABLE search_path(const char* NNULLABLE for_binary) { + if (strchr(for_binary, '/') != NULL) { + // skip absolute paths + return strdup(for_binary); + } char* path_env = getenv("PATH"); if (!path_env) return NULL; char* path = strdup(path_env); @@ -56,7 +60,10 @@ int execvpe_desktop(char** args, char* NNULLABLE* NNULLABLE envlist) { free(args[0]); args[0] = new_arg; - return execve(args[0], args, envlist); + int status = execve(args[0], args, envlist); + free(new_arg); + + return status; } // parse Exec=/bin/prog arg1 arg2\ with\ spaces