From: Dmitry V. Levin Date: Sat, 13 Dec 2014 16:20:44 +0000 (+0000) Subject: chown.c: split into separate files X-Git-Tag: v4.10~282 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f7d020e2258b8565c3809cfe2dd76668a1c433d;p=strace chown.c: split into separate files This will make further uid/gid fixes simpler. * fchownat.c: New file. * chown.c (sys_fchownat: Move to fchownat.c. (sys_chown, sys_fchown): Move to uid.c. * Makefile.am (strace_SOURCES): Remove chown.c, add fchownat.c. --- diff --git a/Makefile.am b/Makefile.am index 9c98a77b..d2864e30 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,7 +26,6 @@ strace_SOURCES = \ capability.c \ chdir.c \ chmod.c \ - chown.c \ clone.c \ count.c \ desc.c \ @@ -36,6 +35,7 @@ strace_SOURCES = \ fadvise.c \ fallocate.c \ fanotify.c \ + fchownat.c \ file.c \ futex.c \ get_robust_list.c \ diff --git a/chown.c b/chown.c deleted file mode 100644 index 6914a48b..00000000 --- a/chown.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "defs.h" - -int -sys_chown(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - printuid(", ", tcp->u_arg[1]); - printuid(", ", tcp->u_arg[2]); - } - return 0; -} - -int -sys_fchownat(struct tcb *tcp) -{ - if (entering(tcp)) { - print_dirfd(tcp, tcp->u_arg[0]); - printpath(tcp, tcp->u_arg[1]); - printuid(", ", tcp->u_arg[2]); - printuid(", ", tcp->u_arg[3]); - tprints(", "); - printflags(at_flags, tcp->u_arg[4], "AT_???"); - } - return 0; -} - -int -sys_fchown(struct tcb *tcp) -{ - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - printuid(", ", tcp->u_arg[1]); - printuid(", ", tcp->u_arg[2]); - } - return 0; -} diff --git a/fchownat.c b/fchownat.c new file mode 100644 index 00000000..95de6e4a --- /dev/null +++ b/fchownat.c @@ -0,0 +1,15 @@ +#include "defs.h" + +int +sys_fchownat(struct tcb *tcp) +{ + if (entering(tcp)) { + print_dirfd(tcp, tcp->u_arg[0]); + printpath(tcp, tcp->u_arg[1]); + printuid(", ", tcp->u_arg[2]); + printuid(", ", tcp->u_arg[3]); + tprints(", "); + printflags(at_flags, tcp->u_arg[4], "AT_???"); + } + return 0; +} diff --git a/uid.c b/uid.c index 0a1a2eea..bab6c5eb 100644 --- a/uid.c +++ b/uid.c @@ -76,6 +76,28 @@ sys_setresuid(struct tcb *tcp) return 0; } +int +sys_chown(struct tcb *tcp) +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + printuid(", ", tcp->u_arg[1]); + printuid(", ", tcp->u_arg[2]); + } + return 0; +} + +int +sys_fchown(struct tcb *tcp) +{ + if (entering(tcp)) { + printfd(tcp, tcp->u_arg[0]); + printuid(", ", tcp->u_arg[1]); + printuid(", ", tcp->u_arg[2]); + } + return 0; +} + void printuid(const char *text, const unsigned int uid) {