Skip to contentSkip to conversation

syscalls/sendfile04: Fix setup()

PATCH New Cyril Hrubis 1 participant 1 message Apr 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/sendfile04: Fix setup()

The in_file has to be opened O_RDWR in order to be useable to be passed to the sendfile(). It does not matter much in this case, since we get the EFAULT even before the kernel attempts to resolve the file descriptors, but let's keep the rest of the parameters to the sycall correct.

---
 testcases/kernel/syscalls/sendfile/sendfile04.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sendfile/sendfile04.c +2 -3
index 4cbc48edc..67d004c74 100644
@@ -48,9 +48,8 @@ struct test_case_t {
 
 static void setup(void)
 {
-	in_fd = SAFE_CREAT("in_file", O_RDONLY);
-	out_fd = SAFE_CREAT("out_file", O_WRONLY);
-	SAFE_WRITE(1, in_fd, "a", 1);
+	in_fd = SAFE_OPEN("in_file", O_CREAT | O_RDWR, 0600);
+	out_fd = SAFE_CREAT("out_file", 0600);
 }
 
 static void cleanup(void)
Signature · 1 line
2.26.3