aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtrace
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-12-03 09:42:54 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2015-12-03 09:42:54 -0500
commit82c4f4ed6e1ba3c5fe87ca260fa6b545cab8a76b (patch)
tree2e1d621febeb282a908bc409f0e7cdcea1f653f9 /src/libtrace
parent--tracelog (diff)
downloadfirejail-82c4f4ed6e1ba3c5fe87ca260fa6b545cab8a76b.tar.gz
firejail-82c4f4ed6e1ba3c5fe87ca260fa6b545cab8a76b.tar.zst
firejail-82c4f4ed6e1ba3c5fe87ca260fa6b545cab8a76b.zip
--tracelog
Diffstat (limited to 'src/libtrace')
-rw-r--r--src/libtrace/libtrace.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c
index 3db931de1..3ca3ec698 100644
--- a/src/libtrace/libtrace.c
+++ b/src/libtrace/libtrace.c
@@ -29,6 +29,7 @@
29#include <arpa/inet.h> 29#include <arpa/inet.h>
30#include <sys/un.h> 30#include <sys/un.h>
31#include <sys/stat.h> 31#include <sys/stat.h>
32#include <dirent.h>
32 33
33// break recursivity on fopen call 34// break recursivity on fopen call
34typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode); 35typedef FILE *(*orig_fopen_t)(const char *pathname, const char *mode);
@@ -431,6 +432,17 @@ int stat64(const char *pathname, struct stat64 *buf) {
431} 432}
432#endif /* __GLIBC__ */ 433#endif /* __GLIBC__ */
433 434
435// opendir
436typedef DIR *(*orig_opendir_t)(const char *pathname);
437static orig_opendir_t orig_opendir = NULL;
438DIR *opendir(const char *pathname) {
439 if (!orig_opendir)
440 orig_opendir = (orig_opendir_t)dlsym(RTLD_NEXT, "opendir");
441
442 DIR *rv = orig_opendir(pathname);
443 printf("%u:%s:opendir %s:%p\n", pid(), name(), pathname, rv);
444 return rv;
445}
434 446
435// access 447// access
436typedef int (*orig_access_t)(const char *pathname, int mode); 448typedef int (*orig_access_t)(const char *pathname, int mode);