All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [COMMITTED] [PATCH] syscalls/sendfile04: Fix setup()
Date: Fri, 23 Apr 2021 15:22:22 +0200	[thread overview]
Message-ID: <20210423132222.25597-1-chrubis@suse.cz> (raw)

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.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/sendfile/sendfile04.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/sendfile/sendfile04.c b/testcases/kernel/syscalls/sendfile/sendfile04.c
index 4cbc48edc..67d004c74 100644
--- a/testcases/kernel/syscalls/sendfile/sendfile04.c
+++ b/testcases/kernel/syscalls/sendfile/sendfile04.c
@@ -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)
-- 
2.26.3


                 reply	other threads:[~2021-04-23 13:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210423132222.25597-1-chrubis@suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.