[LTP] [PATCH] syscalls/mmap09: Drop hardcoded /tmp path
Darren Chang
chihsheng@google.com
Sun Apr 26 05:58:23 CEST 2026
In some environments (such as Android devices), the `/tmp` directory
might not exist, which causes the test to fail during setup when
trying to open `/tmp/mmaptest`.
Since this test already utilizes the new LTP API with `.needs_tmpdir = 1`,
the framework automatically creates and chdirs into a unique temporary
directory. Therefore, we can safely use a relative path for the test
file instead of hardcoding `/tmp`.
Signed-off-by: Darren Chang <chihsheng@google.com>
---
testcases/kernel/syscalls/mmap/mmap09.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/mmap/mmap09.c b/testcases/kernel/syscalls/mmap/mmap09.c
index 8c6b514ab..f2d695268 100644
--- a/testcases/kernel/syscalls/mmap/mmap09.c
+++ b/testcases/kernel/syscalls/mmap/mmap09.c
@@ -43,7 +43,7 @@ static void verify_mmap(unsigned int nr)
static void setup(void)
{
- fd = SAFE_OPEN("/tmp/mmaptest", O_RDWR | O_CREAT, 0666);
+ fd = SAFE_OPEN("mmaptest", O_RDWR | O_CREAT, 0666);
/* set the file to initial size */
SAFE_FTRUNCATE(fd, MAPSIZE);
--
2.54.0.rc2.544.gc7ae2d5bb8-goog
More information about the ltp
mailing list