From 714eb514284252f302e6d0a7b27690eaeaf61e5b Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 27 Jun 2019 16:51:33 +0000 Subject: [PATCH] print_dirfd: do not print trailing comma It was fine to print trailing comma in print_dirfd until introduction of a syscall with the last argument being a dirfd. Now it's time to change print_dirfd. * open.c (print_dirfd): Do not print comma. (SYS_FUNC(open)): Print comma after print_dirfd() invocation. * access.c (SYS_FUNC(faccessat)): Likewise. * chmod.c (SYS_FUNC(fchmodat)): Likewise. * execve.c (SYS_FUNC(execveat)): Likewise. * fanotify.c (SYS_FUNC(fanotify_mark)): Likewise. * fchownat.c (SYS_FUNC(fchownat)): Likewise. * file_handle.c (SYS_FUNC(name_to_handle_at)): Likewise. * link.c (SYS_FUNC(linkat), SYS_FUNC(unlinkat), SYS_FUNC(symlinkat)): Likewise. * mknod.c (SYS_FUNC(mknodat)): Likewise. * move_mount.c (SYS_FUNC(move_mount)): Likewise. * open_tree.c (SYS_FUNC(open_tree)): Likewise. * readlink.c (SYS_FUNC(readlinkat)): Likewise. * renameat.c (decode_renameat): Likewise. * stat.c (SYS_FUNC(newfstatat)): Likewise. * stat64.c (SYS_FUNC(fstatat64)): Likewise. * statx.c (SYS_FUNC(statx)): Likewise. * utimes.c (SYS_FUNC(futimesat), do_utimensat): Likewise. --- access.c | 1 + chmod.c | 1 + execve.c | 1 + fanotify.c | 7 +++---- fchownat.c | 1 + file_handle.c | 1 + link.c | 4 ++++ mknod.c | 1 + move_mount.c | 2 ++ open.c | 3 +-- open_tree.c | 1 + readlink.c | 4 +++- renameat.c | 2 ++ stat.c | 1 + stat64.c | 1 + statx.c | 1 + utimes.c | 2 ++ 17 files changed, 27 insertions(+), 7 deletions(-) diff --git a/access.c b/access.c index 5c2e6e99..d05bd41b 100644 --- a/access.c +++ b/access.c @@ -29,5 +29,6 @@ SYS_FUNC(access) SYS_FUNC(faccessat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); return decode_access(tcp, 1); } diff --git a/chmod.c b/chmod.c index 7668e746..8d105d9f 100644 --- a/chmod.c +++ b/chmod.c @@ -25,6 +25,7 @@ SYS_FUNC(chmod) SYS_FUNC(fchmodat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); decode_chmod(tcp, 1); return RVAL_DECODED; diff --git a/execve.c b/execve.c index b675cd26..d7d5458b 100644 --- a/execve.c +++ b/execve.c @@ -109,6 +109,7 @@ SYS_FUNC(execve) SYS_FUNC(execveat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); decode_execve(tcp, 1); tprints(", "); printflags(at_flags, tcp->u_arg[4], "AT_???"); diff --git a/fanotify.c b/fanotify.c index 9a0d5c62..e0edb7ff 100644 --- a/fanotify.c +++ b/fanotify.c @@ -55,12 +55,11 @@ SYS_FUNC(fanotify_mark) #endif printflags64(fan_event_flags, mask, "FAN_???"); tprints(", "); - if ((int) tcp->u_arg[argn] == FAN_NOFD) { + if ((int) tcp->u_arg[argn] == FAN_NOFD) print_xlat_d(FAN_NOFD); - tprints(", "); - } else { + else print_dirfd(tcp, tcp->u_arg[argn]); - } + tprints(", "); printpath(tcp, tcp->u_arg[argn + 1]); return RVAL_DECODED; diff --git a/fchownat.c b/fchownat.c index 15fcb063..fcdda896 100644 --- a/fchownat.c +++ b/fchownat.c @@ -10,6 +10,7 @@ SYS_FUNC(fchownat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); printuid(", ", tcp->u_arg[2]); printuid(", ", tcp->u_arg[3]); diff --git a/file_handle.c b/file_handle.c index 7ac135b0..a38063c5 100644 --- a/file_handle.c +++ b/file_handle.c @@ -27,6 +27,7 @@ SYS_FUNC(name_to_handle_at) if (entering(tcp)) { /* dirfd */ print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); /* pathname */ printpath(tcp, tcp->u_arg[1]); diff --git a/link.c b/link.c index 3171f9f9..74d715ba 100644 --- a/link.c +++ b/link.c @@ -29,9 +29,11 @@ SYS_FUNC(link) SYS_FUNC(linkat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); print_dirfd(tcp, tcp->u_arg[2]); + tprints(", "); printpath(tcp, tcp->u_arg[3]); tprints(", "); printflags(at_flags, tcp->u_arg[4], "AT_???"); @@ -42,6 +44,7 @@ SYS_FUNC(linkat) SYS_FUNC(unlinkat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); printflags(at_flags, tcp->u_arg[2], "AT_???"); @@ -54,6 +57,7 @@ SYS_FUNC(symlinkat) printpath(tcp, tcp->u_arg[0]); tprints(", "); print_dirfd(tcp, tcp->u_arg[1]); + tprints(", "); printpath(tcp, tcp->u_arg[2]); return RVAL_DECODED; diff --git a/mknod.c b/mknod.c index b01e6000..4b4ff2a4 100644 --- a/mknod.c +++ b/mknod.c @@ -46,6 +46,7 @@ SYS_FUNC(mknod) SYS_FUNC(mknodat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); decode_mknod(tcp, 1); return RVAL_DECODED; diff --git a/move_mount.c b/move_mount.c index b299b73c..df150114 100644 --- a/move_mount.c +++ b/move_mount.c @@ -14,9 +14,11 @@ SYS_FUNC(move_mount) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); print_dirfd(tcp, tcp->u_arg[2]); + tprints(", "); printpath(tcp, tcp->u_arg[3]); tprints(", "); printflags(move_mount_flags, tcp->u_arg[4], "MOVE_MOUNT_???"); diff --git a/open.c b/open.c index 153c93a2..01fd3798 100644 --- a/open.c +++ b/open.c @@ -45,8 +45,6 @@ print_dirfd(struct tcb *tcp, int fd) print_xlat_d(AT_FDCWD); else printfd(tcp, fd); - - tprints(", "); } /* @@ -121,6 +119,7 @@ SYS_FUNC(open) SYS_FUNC(openat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); return decode_open(tcp, 1); } diff --git a/open_tree.c b/open_tree.c index 3d1173ad..15adec52 100644 --- a/open_tree.c +++ b/open_tree.c @@ -15,6 +15,7 @@ SYS_FUNC(open_tree) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); printflags(open_tree_flags, tcp->u_arg[2], "OPEN_TREE_???"); diff --git a/readlink.c b/readlink.c index 6a4920e4..02d254ce 100644 --- a/readlink.c +++ b/readlink.c @@ -44,7 +44,9 @@ SYS_FUNC(readlink) SYS_FUNC(readlinkat) { - if (entering(tcp)) + if (entering(tcp)) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); + } return decode_readlink(tcp, 1); } diff --git a/renameat.c b/renameat.c index 8f7118de..574303d2 100644 --- a/renameat.c +++ b/renameat.c @@ -11,9 +11,11 @@ static void decode_renameat(struct tcb *tcp) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); print_dirfd(tcp, tcp->u_arg[2]); + tprints(", "); printpath(tcp, tcp->u_arg[3]); } diff --git a/stat.c b/stat.c index c7ad4811..5d712c02 100644 --- a/stat.c +++ b/stat.c @@ -44,6 +44,7 @@ SYS_FUNC(newfstatat) { if (entering(tcp)) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); } else { diff --git a/stat64.c b/stat64.c index 62584728..141e89b5 100644 --- a/stat64.c +++ b/stat64.c @@ -44,6 +44,7 @@ SYS_FUNC(fstatat64) { if (entering(tcp)) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); } else { diff --git a/statx.c b/statx.c index 9cc30c4f..cc6bda8d 100644 --- a/statx.c +++ b/statx.c @@ -19,6 +19,7 @@ SYS_FUNC(statx) { if (entering(tcp)) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); diff --git a/utimes.c b/utimes.c index bee78098..d969133a 100644 --- a/utimes.c +++ b/utimes.c @@ -26,6 +26,7 @@ SYS_FUNC(utimes) SYS_FUNC(futimesat) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); print_timeval_utimes(tcp, tcp->u_arg[2]); @@ -37,6 +38,7 @@ static int do_utimensat(struct tcb *const tcp, const print_obj_by_addr_fn print_ts) { print_dirfd(tcp, tcp->u_arg[0]); + tprints(", "); printpath(tcp, tcp->u_arg[1]); tprints(", "); print_ts(tcp, tcp->u_arg[2]); -- 2.40.0