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.
This commit is contained in:
Дмитрий Левин 2014-12-13 16:20:44 +00:00
parent 25ebe46ce2
commit 2f7d020e22
4 changed files with 38 additions and 38 deletions

View File

@ -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 \

37
chown.c
View File

@ -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;
}

15
fchownat.c Normal file
View File

@ -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;
}

22
uid.c
View File

@ -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)
{