Skip to content

Commit 7307046

Browse files
author
Ingo Molnar
committed
objtool: Use O_CREAT with explicit mode mask
Recent Ubuntu enforces 3-argument open() with O_CREAT: CC /home/mingo/tip/tools/objtool/builtin-check.o In file included from /usr/include/fcntl.h:341, from builtin-check.c:9: In function ‘open’, inlined from ‘copy_file’ at builtin-check.c:201:11: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:52:11: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments 52 | __open_missing_mode (); | ^~~~~~~~~~~~~~~~~~~~~~ Use 0400 as the most restrictive mode for the new file. Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: linux-kernel@vger.kernel.org
1 parent 3679906 commit 7307046

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/objtool/builtin-check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static int copy_file(const char *src, const char *dst)
198198
return 1;
199199
}
200200

201-
dst_fd = open(dst, O_WRONLY | O_CREAT | O_TRUNC);
201+
dst_fd = open(dst, O_WRONLY | O_CREAT | O_TRUNC, 0400);
202202
if (dst_fd == -1) {
203203
ERROR("can't open '%s' for writing", dst);
204204
return 1;

0 commit comments

Comments
 (0)