syscall_emul: fix openat when directory does not end in "/"
Before this commit, the following code:
dir_fd = open(".", O_DIRECTORY);
file_fd = openat(dir_fd, "ble", O_CREAT, S_IRUSR | S_IWUSR);
would create a file called ".ble" in the current working directory,
instead of the correct "ble".
Change-Id: I1525a088d49744e29b760387afabef9f1ac98646
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/13005
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Brandon Potter <Brandon.Potter@amd.com>
This commit is contained in:
committed by
Ciro Santilli
parent
8162e0da02
commit
006eb36634
@@ -695,7 +695,7 @@ openImpl(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc,
|
||||
auto ffdp = std::dynamic_pointer_cast<FileFDEntry>(fdep);
|
||||
if (!ffdp)
|
||||
return -EBADF;
|
||||
path.insert(0, ffdp->getFileName());
|
||||
path.insert(0, ffdp->getFileName() + "/");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user