]> granicus.if.org Git - strace/commitdiff
file.c: move getcwd parser to a separate file
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Dec 2014 21:38:59 +0000 (21:38 +0000)
* getcwd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_getcwd): Move to getcwd.c.

Makefile.am
file.c
getcwd.c [new file with mode: 0644]

index 54d12051b77693c5f55a50275d3721e0a0f2d168..f7e477a7ba40187dbd32e6069052e7be46a361a1 100644 (file)
@@ -29,6 +29,7 @@ strace_SOURCES =      \
        fallocate.c     \
        fanotify.c      \
        file.c          \
+       getcwd.c        \
        inotify.c       \
        io.c            \
        ioctl.c         \
diff --git a/file.c b/file.c
index 48212ec75d7a9d4ebc2adc9dbc01bb44bb8ce69e..f13f613b59142271dc626daaf7146cfd305aa206 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1668,16 +1668,3 @@ sys_mknodat(struct tcb *tcp)
                print_dirfd(tcp, tcp->u_arg[0]);
        return decode_mknod(tcp, 1);
 }
-
-int
-sys_getcwd(struct tcb *tcp)
-{
-       if (exiting(tcp)) {
-               if (syserror(tcp))
-                       tprintf("%#lx", tcp->u_arg[0]);
-               else
-                       printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
-               tprintf(", %lu", tcp->u_arg[1]);
-       }
-       return 0;
-}
diff --git a/getcwd.c b/getcwd.c
new file mode 100644 (file)
index 0000000..1b97448
--- /dev/null
+++ b/getcwd.c
@@ -0,0 +1,14 @@
+#include "defs.h"
+
+int
+sys_getcwd(struct tcb *tcp)
+{
+       if (exiting(tcp)) {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[0]);
+               else
+                       printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
+               tprintf(", %lu", tcp->u_arg[1]);
+       }
+       return 0;
+}