From 6eab9caac26b55385896fdddc9ce6aec4bca7abd Mon Sep 17 00:00:00 2001 From: nakst <> Date: Sat, 5 Feb 2022 15:43:17 +0000 Subject: [PATCH] posix subsystem execve use correct base directory --- kernel/posix.cpp | 4 ++-- kernel/scheduler.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/posix.cpp b/kernel/posix.cpp index 058507a..05d59d1 100644 --- a/kernel/posix.cpp +++ b/kernel/posix.cpp @@ -241,7 +241,7 @@ namespace POSIX { const char *devZero = "/dev/zero"; const char *devNull = "/dev/null"; - EsPrint("Open: %s, %x\n", pathLength, path, flags); + // EsPrint("Open: %s, %x\n", pathLength, path, flags); if ((EsCStringLength(devZero) == pathLength && 0 == EsMemoryCompare(path, devZero, pathLength))) { file->type = POSIX_FILE_ZERO; @@ -533,7 +533,7 @@ namespace POSIX { // Start the process. - if (!ProcessStart(process, path, syscall.arguments[1])) { + if (!ProcessStart(process, path, syscall.arguments[1], (KNode *) syscall.arguments[4])) { EsHeapFree(path, 0, K_FIXED); return -ENOMEM; } diff --git a/kernel/scheduler.cpp b/kernel/scheduler.cpp index c04a1ff..9ef799c 100644 --- a/kernel/scheduler.cpp +++ b/kernel/scheduler.cpp @@ -876,9 +876,9 @@ bool ProcessStartWithNode(Process *process, KNode *node) { return true; } -bool ProcessStart(Process *process, char *imagePath, size_t imagePathLength) { +bool ProcessStart(Process *process, char *imagePath, size_t imagePathLength, KNode *baseDirectory = nullptr) { uint64_t flags = ES_FILE_READ | ES_NODE_FAIL_IF_NOT_FOUND; - KNodeInformation node = FSNodeOpen(imagePath, imagePathLength, flags); + KNodeInformation node = FSNodeOpen(imagePath, imagePathLength, flags, baseDirectory); bool result = false; if (!ES_CHECK_ERROR(node.error)) {