chiark / gitweb /
sysv-generator: properly add Makefile symlink
[elogind.git] / src / core / execute.c
index b7ac4c7b2bae3fb20412bf789d51b06c6588aac0..4735ab24178e25db6c06f04ab92bb34351a156ac 100644 (file)
@@ -86,6 +86,7 @@
 #include "smack-util.h"
 #include "bus-kernel.h"
 #include "label.h"
+#include "cap-list.h"
 
 #ifdef HAVE_SECCOMP
 #include "seccomp-util.h"
@@ -129,7 +130,7 @@ static int shift_fds(int fds[], unsigned n_fds) {
                         fds[i] = nfd;
 
                         /* Hmm, the fd we wanted isn't free? Then
-                         * let's remember that and try again from here*/
+                         * let's remember that and try again from here */
                         if (nfd != i+3 && restart_from < 0)
                                 restart_from = i;
                 }
@@ -1350,7 +1351,7 @@ static int exec_child(ExecCommand *command,
         }
 
         if (params->cgroup_path) {
-                err = cg_attach_everywhere(params->cgroup_supported, params->cgroup_path, 0);
+                err = cg_attach_everywhere(params->cgroup_supported, params->cgroup_path, 0, NULL, NULL);
                 if (err < 0) {
                         *error = EXIT_CGROUP;
                         return err;
@@ -1983,7 +1984,7 @@ int exec_context_destroy_runtime_directory(ExecContext *c, const char *runtime_p
                 /* We execute this synchronously, since we need to be
                  * sure this is gone when we start the service
                  * next. */
-                rm_rf_dangerous(p, false, true, false);
+                rm_rf(p, false, true, false);
         }
 
         return 0;
@@ -2006,7 +2007,7 @@ void exec_command_done_array(ExecCommand *c, unsigned n) {
                 exec_command_done(c+i);
 }
 
-void exec_command_free_list(ExecCommand *c) {
+ExecCommand* exec_command_free_list(ExecCommand *c) {
         ExecCommand *i;
 
         while ((i = c)) {
@@ -2014,15 +2015,15 @@ void exec_command_free_list(ExecCommand *c) {
                 exec_command_done(i);
                 free(i);
         }
+
+        return NULL;
 }
 
 void exec_command_free_array(ExecCommand **c, unsigned n) {
         unsigned i;
 
-        for (i = 0; i < n; i++) {
-                exec_command_free_list(c[i]);
-                c[i] = NULL;
-        }
+        for (i = 0; i < n; i++)
+                c[i] = exec_command_free_list(c[i]);
 }
 
 int exec_context_load_environment(const ExecContext *c, const char *unit_id, char ***l) {
@@ -2296,13 +2297,8 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
                 fprintf(f, "%sCapabilityBoundingSet:", prefix);
 
                 for (l = 0; l <= cap_last_cap(); l++)
-                        if (!(c->capability_bounding_set_drop & ((uint64_t) 1ULL << (uint64_t) l))) {
-                                _cleanup_cap_free_charp_ char *t;
-
-                                t = cap_to_name(l);
-                                if (t)
-                                        fprintf(f, " %s", t);
-                        }
+                        if (!(c->capability_bounding_set_drop & ((uint64_t) 1ULL << (uint64_t) l)))
+                                fprintf(f, " %s", strna(capability_to_name(l)));
 
                 fputs("\n", f);
         }