Shell: Fix type builtin PATH resolution

We were not adding a '/' between PATH dir and the command
This commit is contained in:
2026-05-06 15:13:59 +03:00
parent d2e21f9380
commit 912647ce68

View File

@@ -216,9 +216,10 @@ void Builtin::initialize()
for (const auto& path_dir : path_dirs) for (const auto& path_dir : path_dirs)
{ {
char path_buffer[PATH_MAX]; char path_buffer[PATH_MAX];
memcpy(path_buffer, path_dir.data(), path_dir.size()); memcpy(path_buffer, path_dir.data(), path_dir.size());
memcpy(path_buffer + path_dir.size(), argument.data(), argument.size()); path_buffer[path_dir.size()] = '/';
path_buffer[path_dir.size() + argument.size()] = '\0'; memcpy(path_buffer + path_dir.size() + 1, argument.data(), argument.size());
path_buffer[path_dir.size() + 1 + argument.size()] = '\0';
if (is_executable_file(path_buffer)) if (is_executable_file(path_buffer))
{ {