chiark / gitweb /
cgroup: reimplement the last bit of libcgroup functionality natively
[elogind.git] / src / load-fragment.c
index 394aa023f319599054997aee200d8f60dadfb7c5..8e4ec74b0735b98e55ee2bcd1ee665298fa2a673 100644 (file)
@@ -382,7 +382,7 @@ static int config_parse_exec(
                 char *w;
                 size_t l;
                 char *state;
-                bool honour_argv0, write_to_path;
+                bool honour_argv0 = false, ignore = false;
 
                 path = NULL;
                 nce = NULL;
@@ -393,9 +393,17 @@ static int config_parse_exec(
                 if (rvalue[0] == 0)
                         break;
 
-                honour_argv0 = rvalue[0] == '@';
+                if (rvalue[0] == '-') {
+                        ignore = true;
+                        rvalue ++;
+                }
+
+                if (rvalue[0] == '@') {
+                        honour_argv0 = true;
+                        rvalue ++;
+                }
 
-                if (rvalue[honour_argv0 ? 1 : 0] != '/') {
+                if (*rvalue != '/') {
                         log_error("[%s:%u] Invalid executable path in command line: %s", filename, line, rvalue);
                         return -EINVAL;
                 }
@@ -408,19 +416,18 @@ static int config_parse_exec(
                         k++;
                 }
 
-                if (!(n = new(char*, k + (honour_argv0 ? 0 : 1))))
+                if (!(n = new(char*, k + !honour_argv0)))
                         return -ENOMEM;
 
                 k = 0;
-                write_to_path = honour_argv0;
                 FOREACH_WORD_QUOTED(w, l, rvalue, state) {
                         if (strncmp(w, ";", l) == 0)
                                 break;
 
-                        if (write_to_path) {
-                                if (!(path = cunescape_length(w+1, l-1)))
+                        if (honour_argv0 && w == rvalue) {
+                                assert(!path);
+                                if (!(path = cunescape_length(w, l)))
                                         goto fail;
-                                write_to_path = false;
                         } else {
                                 if (!(n[k++] = cunescape_length(w, l)))
                                         goto fail;
@@ -446,6 +453,7 @@ static int config_parse_exec(
 
                 nce->argv = n;
                 nce->path = path;
+                nce->ignore = ignore;
 
                 path_kill_slashes(nce->path);
 
@@ -1554,6 +1562,7 @@ static int load_from_path(Unit *u, const char *path) {
                 { "StopWhenUnneeded",       config_parse_bool,            &u->meta.stop_when_unneeded,                     "Unit"    },
                 { "OnlyByDependency",       config_parse_bool,            &u->meta.only_by_dependency,                     "Unit"    },
                 { "DefaultDependencies",    config_parse_bool,            &u->meta.default_dependencies,                   "Unit"    },
+                { "IgnoreDependencyFailure",config_parse_bool,            &u->meta.ignore_dependency_failure,              "Unit"    },
 
                 { "PIDFile",                config_parse_path,            &u->service.pid_file,                            "Service" },
                 { "ExecStartPre",           config_parse_exec,            u->service.exec_command+SERVICE_EXEC_START_PRE,  "Service" },