From c0df0291eb9ebd3390a5d251069a22e81c7870ec Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Tue, 22 Oct 2024 05:27:43 +0300 Subject: [PATCH] kshell: Check for absolute path --- kshell/shell.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kshell/shell.cpp b/kshell/shell.cpp index c9c0d85..9391cd5 100644 --- a/kshell/shell.cpp +++ b/kshell/shell.cpp @@ -558,11 +558,15 @@ void KShellThread() std::string path = "/bin/"; - path += cmd_only; - if (!fs->PathExists(path.c_str(), nullptr)) - path = "/usr/bin/"; + if (fs->PathIsRelative(cmd_only.c_str())) + { + path += cmd_only; + if (!fs->PathExists(path.c_str(), nullptr)) + path = "/usr/bin/" + cmd_only; + } + else + path = cmd_only; - path += cmd_only; debug("path: %s", path.c_str()); if (fs->PathExists(path.c_str(), nullptr)) {