diff options
author | curiosity-seeker <seeker@posteo.org> | 2016-12-15 12:58:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-15 12:58:32 +0100 |
commit | d8ee390a6ca56fde4baad57dea7572c39d595809 (patch) | |
tree | 255252b15232086e6f65203cda676859ab4117a0 /src/firemon/seccomp.c | |
parent | Update quiterss.profile (diff) | |
parent | added a 1 second delay after xpra server is started (diff) | |
download | firejail-d8ee390a6ca56fde4baad57dea7572c39d595809.tar.gz firejail-d8ee390a6ca56fde4baad57dea7572c39d595809.tar.zst firejail-d8ee390a6ca56fde4baad57dea7572c39d595809.zip |
Merge pull request #1 from netblue30/master
Bring fork up-to-date
Diffstat (limited to 'src/firemon/seccomp.c')
-rw-r--r-- | src/firemon/seccomp.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/firemon/seccomp.c b/src/firemon/seccomp.c index 71771c72d..f11c624ea 100644 --- a/src/firemon/seccomp.c +++ b/src/firemon/seccomp.c | |||
@@ -22,10 +22,8 @@ | |||
22 | #define MAXBUF 4098 | 22 | #define MAXBUF 4098 |
23 | static void print_seccomp(int pid) { | 23 | static void print_seccomp(int pid) { |
24 | char *file; | 24 | char *file; |
25 | if (asprintf(&file, "/proc/%d/status", pid) == -1) { | 25 | if (asprintf(&file, "/proc/%d/status", pid) == -1) |
26 | errExit("asprintf"); | 26 | errExit("asprintf"); |
27 | exit(1); | ||
28 | } | ||
29 | 27 | ||
30 | FILE *fp = fopen(file, "r"); | 28 | FILE *fp = fopen(file, "r"); |
31 | if (!fp) { | 29 | if (!fp) { |
@@ -48,17 +46,15 @@ static void print_seccomp(int pid) { | |||
48 | free(file); | 46 | free(file); |
49 | } | 47 | } |
50 | 48 | ||
51 | void seccomp(pid_t pid) { | 49 | void seccomp(pid_t pid, int print_procs) { |
52 | if (getuid() == 0) | ||
53 | firemon_drop_privs(); | ||
54 | |||
55 | pid_read(pid); // include all processes | 50 | pid_read(pid); // include all processes |
56 | 51 | ||
57 | // print processes | 52 | // print processes |
58 | int i; | 53 | int i; |
59 | for (i = 0; i < max_pids; i++) { | 54 | for (i = 0; i < max_pids; i++) { |
60 | if (pids[i].level == 1) { | 55 | if (pids[i].level == 1) { |
61 | pid_print_list(i, 0); | 56 | if (print_procs || pid == 0) |
57 | pid_print_list(i, 0); | ||
62 | int child = find_child(i); | 58 | int child = find_child(i); |
63 | if (child != -1) | 59 | if (child != -1) |
64 | print_seccomp(child); | 60 | print_seccomp(child); |