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)
|
|
|
|
---
|
2013-04-19 22:31:17 +02:00
|
|
|
src/systemctl/systemctl.c | 22 ++++++++++++++++++++++
|
|
|
|
1 file changed, 22 insertions(+)
|
2013-04-13 13:09:53 +02:00
|
|
|
|
2013-10-02 13:01:24 +02:00
|
|
|
Index: systemd-208/src/systemctl/systemctl.c
|
|
|
|
===================================================================
|
|
|
|
--- systemd-208.orig/src/systemctl/systemctl.c
|
|
|
|
+++ systemd-208/src/systemctl/systemctl.c
|
|
|
|
@@ -6115,6 +6115,28 @@ int main(int argc, char*argv[]) {
|
|
|
|
* ellipsized. */
|
|
|
|
original_stdout_is_tty = isatty(STDOUT_FILENO);
|
2013-01-23 14:44:07 +01:00
|
|
|
|
2013-04-19 22:31:17 +02:00
|
|
|
+ if (secure_getenv("SYSTEMCTL_OPTIONS") &&
|
|
|
|
+ (!program_invocation_short_name ||
|
|
|
|
+ (program_invocation_short_name && strstr(program_invocation_short_name, "systemctl")))) {
|
2013-01-23 14:44:07 +01:00
|
|
|
+ char **parsed_systemctl_options = strv_split_quoted(getenv("SYSTEMCTL_OPTIONS"));
|
|
|
|
+
|
|
|
|
+ if (*parsed_systemctl_options && **parsed_systemctl_options) {
|
|
|
|
+ char **k,**a;
|
2013-05-15 16:09:16 +02:00
|
|
|
+ char **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-19 22:31:17 +02:00
|
|
|
r = parse_argv(argc, argv);
|
|
|
|
if (r < 0)
|
|
|
|
goto finish;
|