Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] libtracefs: use mode with open()
@ 2021-04-23 23:26 Sudip Mukherjee
  2021-04-26 13:34 ` Tzvetomir Stoyanov
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2021-04-23 23:26 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Sudip Mukherjee

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libtracefs: use mode with open()
  2021-04-23 23:26 [PATCH] libtracefs: use mode with open() Sudip Mukherjee
@ 2021-04-26 13:34 ` Tzvetomir Stoyanov
  0 siblings, 0 replies; 2+ messages in thread
From: Tzvetomir Stoyanov @ 2021-04-26 13:34 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Steven Rostedt, Linux Trace Devel

On Sat, Apr 24, 2021 at 2:27 AM Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
>
> 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>

Thanks Sudip!
Acked-by: Tzvetomir Stoyanov <tz.stoyanov@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
>
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 23:26 [PATCH] libtracefs: use mode with open() Sudip Mukherjee
2021-04-26 13:34 ` Tzvetomir Stoyanov

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git