]> granicus.if.org Git - strace/commitdiff
chown.c: split into separate files
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 13 Dec 2014 16:20:44 +0000 (16:20 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 15 Dec 2014 23:54:37 +0000 (23:54 +0000)
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.

Makefile.am
chown.c [deleted file]
fchownat.c [new file with mode: 0644]
uid.c

index 9c98a77b399ae7015bac2bcbd4692e1e0a9c4188..d2864e30d8922ba77b34c05adb90bb02d0351e89 100644 (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 \
diff --git a/chown.c b/chown.c
deleted file mode 100644 (file)
index 6914a48..0000000
--- 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 (file)
index 0000000..95de6e4
--- /dev/null
@@ -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 0a1a2eea721800dc6178f93199c8ebba49683e42..bab6c5eb6860abd0f795ae80220d9a07623b525b 100644 (file)
--- 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)
 {