2013-04-13 13:09:53 +02:00
|
|
|
From: Frederic Crozat <fcrozat@suse.com>
|
|
|
|
Date: Tue, 22 Jan 2013 17:02:04 +0000
|
|
|
|
Subject: handle SYSTEMCTL_OPTIONS environment variable
|
|
|
|
|
|
|
|
(bnc#798620)
|
|
|
|
---
|
|
|
|
src/systemctl/systemctl.c | 20 ++++++++++++++++++++
|
|
|
|
1 file changed, 20 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
|
|
index 36918f2..28d6586 100644
|
|
|
|
--- a/src/systemctl/systemctl.c
|
|
|
|
+++ b/src/systemctl/systemctl.c
|
|
|
|
@@ -4340,6 +4340,26 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
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;
|
2013-04-13 13:09:53 +02:00
|
|
|
+ char _cleanup_strv_free_ **new_argv = new(char*, strv_length(argv) + strv_length(parsed_systemctl_options) + 1);
|
2013-01-23 14:44:07 +01:00
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2013-04-13 13:09:53 +02:00
|
|
|
while ((c = getopt_long(argc, argv, "ht:p:aqfs:H:Pn:o:i", options, NULL)) >= 0) {
|
2013-01-23 14:44:07 +01:00
|
|
|
|
2013-04-11 12:11:09 +02:00
|
|
|
switch (c) {
|