SHA256
1
0
forked from pool/systemd
systemd/handle-SYSTEMCTL_OPTIONS-environment-variable.patch
Robert Milasan 0201053d5c Accepting request 178519 from home:rmilasan:branches:Base:System
- Add udev MSFT compability rules (bnc#805059).
  add: 1007-add-msft-compability-rules.patch
- Add sg3_utils requires, need it by 61-msft.rules (bnc#805059).
- Clean-up spec file, put udev patches after systemd patches.
- Rebase patches so they would apply nicely.

- Add udev MSFT compability rules (bnc#805059).
  add: 1007-add-msft-compability-rules.patch
- Add sg3_utils requires, need it by 61-msft.rules (bnc#805059).
- Clean-up spec file, put udev patches after systemd patches.
- Rebase patches so they would apply nicely.

OBS-URL: https://build.opensuse.org/request/show/178519
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=391
2013-06-11 11:22:32 +00:00

43 lines
1.8 KiB
Diff

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 | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
Index: systemd-204/src/systemctl/systemctl.c
===================================================================
--- systemd-204.orig/src/systemctl/systemctl.c
+++ systemd-204/src/systemctl/systemctl.c
@@ -5974,6 +5974,28 @@ int main(int argc, char*argv[]) {
log_parse_environment();
log_open();
+ if (secure_getenv("SYSTEMCTL_OPTIONS") &&
+ (!program_invocation_short_name ||
+ (program_invocation_short_name && strstr(program_invocation_short_name, "systemctl")))) {
+ 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);
+ }
+ }
+
r = parse_argv(argc, argv);
if (r < 0)
goto finish;