From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH] libtracefs: use mode with open()
Date: Sat, 24 Apr 2021 00:26:48 +0100 [thread overview]
Message-ID: <20210423232648.1197063-1-sudipm.mukherjee@gmail.com> (raw)
If -D_FORTIFY_SOURCE=2 is mentioned as a buildflag then the build fails
with the error:
In function ‘open’,
inlined from ‘copy_trace_file’ at tracefs-utest.c:1032:10:
error: call to ‘__open_missing_mode’ declared with attribute error:
open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
Mention the permission with open() when O_CREAT is mentioned.
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
utest/tracefs-utest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index edb3a3d..0965363 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -1061,7 +1061,7 @@ static void copy_trace_file(const char *from, char *to)
fd_from = open(from, O_RDONLY);
if (fd_from < 0)
goto out;
- fd_to = open(to, O_WRONLY | O_TRUNC | O_CREAT);
+ fd_to = open(to, O_WRONLY | O_TRUNC | O_CREAT, S_IRWXU | S_IRWXG);
if (fd_to < 0)
goto out;
--
2.30.2
next reply other threads:[~2021-04-23 23:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 23:26 Sudip Mukherjee [this message]
2021-04-26 13:34 ` [PATCH] libtracefs: use mode with open() Tzvetomir Stoyanov
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=20210423232648.1197063-1-sudipm.mukherjee@gmail.com \
--to=sudipm.mukherjee@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).