From f3b5873b745ce4faf05407bf52c8ab38100dc217 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sat, 13 Aug 2016 14:42:39 -0400 Subject: various fixes --- src/faudit/dbus.c | 2 -- src/firejail/checkcfg.c | 4 ++-- src/firejail/env.c | 3 ++- src/firejail/main.c | 30 ++++++++++++++++++++---------- src/firejail/x11.c | 3 ++- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/faudit/dbus.c b/src/faudit/dbus.c index 1edce5802..64f5d8ae4 100644 --- a/src/faudit/dbus.c +++ b/src/faudit/dbus.c @@ -63,8 +63,6 @@ void dbus_test(void) { if (ptr) *ptr = '\0'; check_session_bus(sockfile); - - sockfile -= 13; } free(bus); } diff --git a/src/firejail/checkcfg.c b/src/firejail/checkcfg.c index 3b60dafb6..019b54773 100644 --- a/src/firejail/checkcfg.c +++ b/src/firejail/checkcfg.c @@ -50,7 +50,7 @@ int checkcfg(int val) { FILE *fp = fopen(fname, "r"); if (!fp) { #ifdef HAVE_GLOBALCFG - fprintf(stderr, "Warning: Firejail configuration file %s not found\n", fname); + fprintf(stderr, "Error: Firejail configuration file %s not found\n", fname); exit(1); #else initialized = 1; @@ -317,7 +317,7 @@ void print_compiletime_support(void) { #endif ); - printf("\t- X11 snadboxing support is %s\n", + printf("\t- X11 sandboxing support is %s\n", #ifdef HAVE_X11 "enabled" #else diff --git a/src/firejail/env.c b/src/firejail/env.c index 79d6b81e3..dd51b0a78 100644 --- a/src/firejail/env.c +++ b/src/firejail/env.c @@ -133,7 +133,8 @@ void env_defaults(void) { errExit("setenv"); // set the window title - printf("\033]0;firejail %s\007", cfg.window_title);fflush(0); + printf("\033]0;firejail %s\007", cfg.window_title); + fflush(0); } // parse and store the environment setting diff --git a/src/firejail/main.c b/src/firejail/main.c index acae7c3dd..7b8b770ab 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -237,7 +237,8 @@ void check_user_namespace(void) { stat("/proc/self/gid_map", &s3) == 0) arg_noroot = 1; else { - fprintf(stderr, "Warning: user namespaces not available in the current kernel.\n"); + if (!arg_quiet || arg_debug) + fprintf(stderr, "Warning: user namespaces not available in the current kernel.\n"); arg_noroot = 0; } } @@ -1526,7 +1527,8 @@ int main(int argc, char **argv) { errExit("strdup"); if (net_get_if_addr(intf->dev, &intf->ip, &intf->mask, intf->mac, &intf->mtu)) { - fprintf(stderr, "Warning: interface %s is not configured\n", intf->dev); + if (!arg_quiet || arg_debug) + fprintf(stderr, "Warning: interface %s is not configured\n", intf->dev); } intf->configured = 1; } @@ -1945,8 +1947,10 @@ int main(int argc, char **argv) { } // check trace configuration - if (arg_trace && arg_tracelog) - fprintf(stderr, "Warning: --trace and --tracelog are mutually exclusive; --tracelog disabled\n"); + if (arg_trace && arg_tracelog) { + if (!arg_quiet || arg_debug) + fprintf(stderr, "Warning: --trace and --tracelog are mutually exclusive; --tracelog disabled\n"); + } // check user namespace (--noroot) options if (arg_noroot) { @@ -2030,10 +2034,14 @@ int main(int argc, char **argv) { // use default.profile as the default if (!custom_profile && !arg_noprofile) { - if (cfg.chrootdir) - fprintf(stderr, "Warning: default profile disabled by --chroot option\n"); - else if (arg_overlay) - fprintf(stderr, "Warning: default profile disabled by --overlay option\n"); + if (cfg.chrootdir) { + if (!arg_quiet || arg_debug) + fprintf(stderr, "Warning: default profile disabled by --chroot option\n"); + } + else if (arg_overlay) { + if (!arg_quiet || arg_debug) + fprintf(stderr, "Warning: default profile disabled by --overlay option\n"); + } else { // try to load a default profile char *profile_name = DEFAULT_USER_PROFILE; @@ -2096,11 +2104,13 @@ int main(int argc, char **argv) { errExit("pipe"); if (arg_noroot && arg_overlay) { - fprintf(stderr, "Warning: --overlay and --noroot are mutually exclusive, noroot disabled\n"); + if (!arg_quiet || arg_debug) + fprintf(stderr, "Warning: --overlay and --noroot are mutually exclusive, noroot disabled\n"); arg_noroot = 0; } else if (arg_noroot && cfg.chrootdir) { - fprintf(stderr, "Warning: --chroot and --noroot are mutually exclusive, noroot disabled\n"); + if (!arg_quiet || arg_debug) + fprintf(stderr, "Warning: --chroot and --noroot are mutually exclusive, noroot disabled\n"); arg_noroot = 0; } diff --git a/src/firejail/x11.c b/src/firejail/x11.c index 58908e9df..90ce1fc36 100644 --- a/src/firejail/x11.c +++ b/src/firejail/x11.c @@ -458,7 +458,8 @@ void x11_start_xpra(int argc, char **argv) { if (jail < 0) errExit("fork"); if (jail == 0) { - execvp(firejail_argv[0], firejail_argv); + if (firejail_argv[0]) // shut up llvm scan-build + execvp(firejail_argv[0], firejail_argv); perror("execvp"); exit(1); } -- cgit v1.2.3-70-g09d2