diff options
author | Ciro Santilli <ciro.santilli@arm.com> | 2018-09-26 17:11:07 +0100 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@gmail.com> | 2018-10-30 14:53:42 +0000 |
commit | 006eb36634a35f6b6d44ee63254f31ba96ac5267 (patch) | |
tree | d85550e5860be8e7568eb4d222c6d631ee5cf359 /src | |
parent | 8162e0da0285d346046151b2a45ceeb1baf63b8f (diff) | |
download | gem5-006eb36634a35f6b6d44ee63254f31ba96ac5267.tar.xz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/sim/syscall_emul.hh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index c7818b6c6..17d410937 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -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() + "/"); } /** |