2013-01-23 14:44:07 +01:00
|
|
|
Index: systemd-195/src/systemctl/systemctl.c
|
|
|
|
===================================================================
|
|
|
|
--- systemd-195.orig/src/systemctl/systemctl.c
|
|
|
|
+++ systemd-195/src/systemctl/systemctl.c
|
2013-04-11 12:11:09 +02:00
|
|
|
@@ -4118,10 +4118,32 @@ static int systemctl_parse_argv(int argc
|
|
|
|
};
|
2013-01-23 14:44:07 +01:00
|
|
|
|
2013-04-11 12:11:09 +02:00
|
|
|
int c;
|
2013-01-23 14:44:07 +01:00
|
|
|
+ char **to_free = NULL;
|
|
|
|
|
2013-04-11 12:11:09 +02:00
|
|
|
assert(argc >= 0);
|
|
|
|
assert(argv);
|
2013-01-23 14:44:07 +01:00
|
|
|
|
|
|
|
+ if (secure_getenv("SYSTEMCTL_OPTIONS")) {
|
|
|
|
+ char **parsed_systemctl_options = strv_split_quoted(getenv("SYSTEMCTL_OPTIONS"));
|
|
|
|
+
|
|
|
|
+ if (*parsed_systemctl_options && **parsed_systemctl_options) {
|
|
|
|
+ char **k,**a;
|
|
|
|
+ char **new_argv = new(char*, strv_length(argv) + strv_length(parsed_systemctl_options) + 1);
|
|
|
|
+ new_argv[0] = strdup(argv[0]);
|
|
|
|
+ for (k = new_argv+1, a = parsed_systemctl_options; *a; k++, a++) {
|
|
|
|
+ *k = strdup(*a);
|
|
|
|
+ }
|
|
|
|
+ for (a = argv+1; *a; k++, a++) {
|
|
|
|
+ *k = strdup(*a);
|
|
|
|
+ }
|
|
|
|
+ *k = NULL;
|
|
|
|
+ argv = new_argv;
|
|
|
|
+ argc = strv_length(new_argv);
|
|
|
|
+ strv_free (parsed_systemctl_options);
|
|
|
|
+ to_free = new_argv;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2013-04-11 12:11:09 +02:00
|
|
|
while ((c = getopt_long(argc, argv, "ht:p:aqfs:H:Pn:o:", options, NULL)) >= 0) {
|
2013-01-23 14:44:07 +01:00
|
|
|
|
2013-04-11 12:11:09 +02:00
|
|
|
switch (c) {
|
|
|
|
@@ -4297,6 +4319,8 @@ static int systemctl_parse_argv(int argc
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2013-01-23 14:44:07 +01:00
|
|
|
|
|
|
|
+ strv_free(to_free);
|
|
|
|
+
|
2013-04-11 12:11:09 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|