>From 0f981111c5efa3dc0d96f323e9c799ca5d9a6e7e Mon Sep 17 00:00:00 2001
From: William Douglas <[email protected]>
Date: Mon, 6 Feb 2012 16:18:56 -0800
Subject: [PATCH] systemd: Add systemd.setenv for /proc/cmdline parsing.

Check for systemd.setenv when parsing /proc/cmdline.
ex: systemd.setenv=PATH=/opt/bin

Signed-off-by: William Douglas <[email protected]>
---
 src/main.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c
index 5c28a6c..16fff05 100644
--- a/src/main.c
+++ b/src/main.c
@@ -319,6 +319,19 @@ static int parse_proc_cmdline_word(const char *word) {
                         log_warning("Failed to parse default standard
error switch %s, Ignoring.", word + 31);
                 else
                         arg_default_std_error = r;
+        } else if (startswith(word, "systemd.setenv=")) {
+                char *eq;
+                int r;
+
+                if (!(eq = strchr(word + 15, '=')))
+                        log_warning("Failed to parse setenv switch %s.
Ignoring.", word + 15);
+                else {
+                        *eq = 0;
+                        r = setenv(word + 15, eq + 1, 1);
+                        if (r)
+                                log_warning("Failed setenv call with %s.
Ignoring", strerror(-r));
+                        *eq = '=';
+                }
 #ifdef HAVE_SYSV_COMPAT
         } else if (startswith(word, "systemd.sysv_console=")) {
                 int r;
-- 
1.7.9
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to