chiark / gitweb /
execute: downgrade namespace error to "warning"
[elogind.git] / src / core / execute.c
index 07ec7a28d642bb5b069973ca4bb9c9bee1deff58..4b0767aed3151946f63653bc973503fe744e0d75 100644 (file)
@@ -1545,7 +1545,10 @@ static int exec_child(ExecCommand *command,
                                 context->protect_home,
                                 context->protect_system,
                                 context->mount_flags);
-                if (err < 0) {
+
+                if (err == -EPERM)
+                        log_warning_unit(params->unit_id, "Failed to set up file system namespace due to lack of privileges. Execution sandbox will not be in effect: %s", strerror(-err));
+                else if (err < 0) {
                         *error = EXIT_NAMESPACE;
                         return err;
                 }
@@ -1698,7 +1701,7 @@ static int exec_child(ExecCommand *command,
                         err = aa_change_onexec(context->apparmor_profile);
                         if (err < 0 && !context->apparmor_profile_ignore) {
                                 *error = EXIT_APPARMOR_PROFILE;
-                                return err;
+                                return -errno;
                         }
                 }
 #endif
@@ -2567,8 +2570,8 @@ int exec_command_set(ExecCommand *c, const char *path, ...) {
 }
 
 int exec_command_append(ExecCommand *c, const char *path, ...) {
+        _cleanup_strv_free_ char **l = NULL;
         va_list ap;
-        char **l;
         int r;
 
         assert(c);
@@ -2582,10 +2585,8 @@ int exec_command_append(ExecCommand *c, const char *path, ...) {
                 return -ENOMEM;
 
         r = strv_extend_strv(&c->argv, l);
-        if (r < 0) {
-                strv_free(l);
+        if (r < 0)
                 return r;
-        }
 
         return 0;
 }