aboutsummaryrefslogtreecommitdiffstats
path: root/src/fseccomp
diff options
context:
space:
mode:
authorLibravatar startx2017 <vradu.startx@yandex.com>2017-04-10 09:24:00 -0400
committerLibravatar startx2017 <vradu.startx@yandex.com>2017-04-10 09:24:00 -0400
commitb05f7f3bd9d0264a6e143e10269e3eca5416b048 (patch)
treec14f7114ddfd89fcaa32a3ed458e150131cd07de /src/fseccomp
parentDoc update for baloo_file profile (diff)
downloadfirejail-b05f7f3bd9d0264a6e143e10269e3eca5416b048.tar.gz
firejail-b05f7f3bd9d0264a6e143e10269e3eca5416b048.tar.zst
firejail-b05f7f3bd9d0264a6e143e10269e3eca5416b048.zip
--quiet fixes
Diffstat (limited to 'src/fseccomp')
-rw-r--r--src/fseccomp/fseccomp.h3
-rw-r--r--src/fseccomp/main.c5
-rw-r--r--src/fseccomp/protocol.c6
-rw-r--r--src/fseccomp/syscall.c6
4 files changed, 16 insertions, 4 deletions
diff --git a/src/fseccomp/fseccomp.h b/src/fseccomp/fseccomp.h
index e0d423b4a..1e4881e9c 100644
--- a/src/fseccomp/fseccomp.h
+++ b/src/fseccomp/fseccomp.h
@@ -25,6 +25,9 @@
25#include <assert.h> 25#include <assert.h>
26#include "../include/common.h" 26#include "../include/common.h"
27 27
28// main.c
29extern int arg_quiet;
30
28// syscall.c 31// syscall.c
29void syscall_print(void); 32void syscall_print(void);
30int syscall_check_list(const char *slist, void (*callback)(int fd, int syscall, int arg), int fd, int arg); 33int syscall_check_list(const char *slist, void (*callback)(int fd, int syscall, int arg), int fd, int arg);
diff --git a/src/fseccomp/main.c b/src/fseccomp/main.c
index 134b840f2..7e0239a5f 100644
--- a/src/fseccomp/main.c
+++ b/src/fseccomp/main.c
@@ -18,6 +18,7 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/ 19*/
20#include "fseccomp.h" 20#include "fseccomp.h"
21int arg_quiet = 0;
21 22
22static void usage(void) { 23static void usage(void) {
23 printf("Usage:\n"); 24 printf("Usage:\n");
@@ -51,6 +52,10 @@ printf("\n");
51 usage(); 52 usage();
52 return 1; 53 return 1;
53 } 54 }
55
56 char *quiet = getenv("FIREJAIL_QUIET");
57 if (quiet && strcmp(quiet, "yes") == 0)
58 arg_quiet = 1;
54 59
55 if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") ==0) { 60 if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") ==0) {
56 usage(); 61 usage();
diff --git a/src/fseccomp/protocol.c b/src/fseccomp/protocol.c
index e9f65e7e8..57ce2f8e0 100644
--- a/src/fseccomp/protocol.c
+++ b/src/fseccomp/protocol.c
@@ -89,7 +89,8 @@ static struct sock_filter *find_protocol_domain(const char *p) {
89 89
90void protocol_print(void) { 90void protocol_print(void) {
91#ifndef SYS_socket 91#ifndef SYS_socket
92 fprintf(stderr, "Warning fseccomp: firejail --protocol not supported on this platform\n"); 92 if (!arg_quiet)
93 fprintf(stderr, "Warning fseccomp: firejail --protocol not supported on this platform\n");
93 return; 94 return;
94#endif 95#endif
95 96
@@ -107,7 +108,8 @@ void protocol_build_filter(const char *prlist, const char *fname) {
107 assert(fname); 108 assert(fname);
108 109
109#ifndef SYS_socket 110#ifndef SYS_socket
110 fprintf(stderr, "Warning fseccomp: --protocol not supported on this platform\n"); 111 if (!arg_quiet)
112 fprintf(stderr, "Warning fseccomp: --protocol not supported on this platform\n");
111 return; 113 return;
112#else 114#else
113 // build the filter 115 // build the filter
diff --git a/src/fseccomp/syscall.c b/src/fseccomp/syscall.c
index 398a49578..b86c1c489 100644
--- a/src/fseccomp/syscall.c
+++ b/src/fseccomp/syscall.c
@@ -130,8 +130,10 @@ int syscall_check_list(const char *slist, void (*callback)(int fd, int syscall,
130 int syscall_nr; 130 int syscall_nr;
131 int error_nr; 131 int error_nr;
132 syscall_process_name(ptr, &syscall_nr, &error_nr); 132 syscall_process_name(ptr, &syscall_nr, &error_nr);
133 if (syscall_nr == -1) 133 if (syscall_nr == -1) {
134 fprintf(stderr, "Warning fseccomp: syscall %s not found\n", ptr); 134 if (!arg_quiet)
135 fprintf(stderr, "Warning fseccomp: syscall \"%s\" not available on this platform\n", ptr);
136 }
135 else if (callback != NULL) { 137 else if (callback != NULL) {
136 if (error_nr != -1) 138 if (error_nr != -1)
137 filter_add_errno(fd, syscall_nr, error_nr); 139 filter_add_errno(fd, syscall_nr, error_nr);