diff options
author | 2017-09-19 09:47:26 -0400 | |
---|---|---|
committer | 2017-09-19 09:47:26 -0400 | |
commit | cbbc90381b41156c16bcb30934a10c843c8298c0 (patch) | |
tree | e21319a023b5883eb3aa5a50b4bd27e19e047a49 /src/libtrace/libtrace.c | |
parent | update KDE whitelist (diff) | |
download | firejail-cbbc90381b41156c16bcb30934a10c843c8298c0.tar.gz firejail-cbbc90381b41156c16bcb30934a10c843c8298c0.tar.zst firejail-cbbc90381b41156c16bcb30934a10c843c8298c0.zip |
add private-bin support to profile builder
Diffstat (limited to 'src/libtrace/libtrace.c')
-rw-r--r-- | src/libtrace/libtrace.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index 5cdb254a3..04cf64997 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c | |||
@@ -673,3 +673,15 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid) { | |||
673 | 673 | ||
674 | return rv; | 674 | return rv; |
675 | } | 675 | } |
676 | |||
677 | // every time a new process is started, this gets called | ||
678 | // it can be used to build things like private-bin | ||
679 | __attribute__((constructor)) | ||
680 | static void log_exec(int argc, char** argv) { | ||
681 | static char buf[PATH_MAX + 1]; | ||
682 | int rv = readlink("/proc/self/exe", buf, PATH_MAX); | ||
683 | if (rv != -1) { | ||
684 | buf[rv] = '\0'; // readlink does not add a '\0' at the end | ||
685 | printf("%u:%s:exec %s:0\n", pid(), name(), buf); | ||
686 | } | ||
687 | } | ||