decode_open: print the mode argument when O_TMPFILE flag is set
O_TMPFILE reqires the mode argument (just like O_CREAT), so print it. * open.c (STRACE_O_TMPFILE): New macro. (decode_open): Print the mode argument when O_TMPFILE flag is set. * tests/open.c (main): Check it. Fixes RH#1377846.
This commit is contained in:
parent
0918a4c3a2
commit
212a444bdc
9
open.c
9
open.c
@ -115,6 +115,13 @@ tprint_open_modes(unsigned int flags)
|
||||
tprints(sprint_open_modes(flags) + sizeof("flags"));
|
||||
}
|
||||
|
||||
#ifdef O_TMPFILE
|
||||
/* The kernel & C libraries often inline O_DIRECTORY. */
|
||||
# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY)
|
||||
#else /* !O_TMPFILE */
|
||||
# define STRACE_O_TMPFILE 0
|
||||
#endif
|
||||
|
||||
static int
|
||||
decode_open(struct tcb *tcp, int offset)
|
||||
{
|
||||
@ -122,7 +129,7 @@ decode_open(struct tcb *tcp, int offset)
|
||||
tprints(", ");
|
||||
/* flags */
|
||||
tprint_open_modes(tcp->u_arg[offset + 1]);
|
||||
if (tcp->u_arg[offset + 1] & O_CREAT) {
|
||||
if (tcp->u_arg[offset + 1] & (O_CREAT | STRACE_O_TMPFILE)) {
|
||||
/* mode */
|
||||
tprints(", ");
|
||||
print_numeric_umode_t(tcp->u_arg[offset + 2]);
|
||||
|
11
tests/open.c
11
tests/open.c
@ -56,6 +56,17 @@ main(void)
|
||||
sample, sprintrc(fd));
|
||||
}
|
||||
|
||||
#ifdef O_TMPFILE
|
||||
# if O_TMPFILE == (O_TMPFILE & ~O_DIRECTORY)
|
||||
# define STR_O_TMPFILE "O_TMPFILE"
|
||||
# else
|
||||
# define STR_O_TMPFILE "O_DIRECTORY|O_TMPFILE"
|
||||
# endif
|
||||
fd = syscall(__NR_open, sample, O_WRONLY|O_TMPFILE, 0600);
|
||||
printf("open(\"%s\", O_WRONLY|%s, 0600) = %s\n",
|
||||
sample, STR_O_TMPFILE, sprintrc(fd));
|
||||
#endif /* O_TMPFILE */
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user