posix subsystem execve use correct base directory

This commit is contained in:
nakst 2022-02-05 15:43:17 +00:00
parent 3449720359
commit 6eab9caac2
2 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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)) {