libtracefs: use mode with open()
PATCH 1/1 libtracefs: use mode with open()
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.
--- utest/tracefs-utest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utest/tracefs-utest.c +1 -1
@@ -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;
Signature · 1 line
2.30.2
Quoted 11 lines · 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 withO_CREATorO_TMPFILEin second argument needs 3 argumentsMention the permission with
open()whenO_CREATis mentioned.Signed-off-by Sudip Mukherjee <[email protected]>
Thanks Sudip!
Quoted 18 lines
--- utest/tracefs-utest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)utest/tracefs-utest.c +1
-2@@ -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; --
Quoted 2 lines
2.30.2
--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center