aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rc-plugin.c21
-rw-r--r--src/rc.c6
2 files changed, 14 insertions, 13 deletions
diff --git a/src/rc-plugin.c b/src/rc-plugin.c
index aca20239..2d3d7072 100644
--- a/src/rc-plugin.c
+++ b/src/rc-plugin.c
@@ -132,20 +132,23 @@ void rc_plugin_run (rc_hook_t hook, const char *value)
char buffer[RC_LINEBUFFER];
char *token;
char *p;
+ ssize_t nr;
close (pfd[1]);
memset (buffer, 0, sizeof (buffer));
- /* Not the best implementation in the world.
- * We should be able to handle >1 env var.
- * Maybe split the strings with a NULL character? */
- while (read (pfd[0], buffer, sizeof (buffer)) > 0) {
+ while ((nr = read (pfd[0], buffer, sizeof (buffer))) > 0) {
p = buffer;
- token = strsep (&p, "=");
- if (token) {
- unsetenv (token);
- if (p)
- setenv (token, p, 1);
+ while (*p && p - buffer < nr) {
+ token = strsep (&p, "=");
+ if (token) {
+ unsetenv (token);
+ if (*p) {
+ setenv (token, p, 1);
+ p += strlen (p) + 1;
+ } else
+ p++;
+ }
}
}
diff --git a/src/rc.c b/src/rc.c
index 3b9eaf1a..d20616fb 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -398,8 +398,7 @@ static void sulogin (bool cont)
eerrorx ("%s: vfork: %s", applet, strerror (errno));
if (pid == 0) {
#ifdef __linux__
- execle ("/sbin/sulogin", "/sbin/sulogin",
- getenv ("CONSOLE"), (char *) NULL, newenv);
+ execle ("/sbin/sulogin", "/sbin/sulogin", (char *) NULL, newenv);
eerror ("%s: unable to exec `/sbin/sulogin': %s", applet,
strerror (errno));
#else
@@ -412,8 +411,7 @@ static void sulogin (bool cont)
waitpid (pid, &status, 0);
} else {
#ifdef __linux
- execle ("/sbin/sulogin", "/sbin/sulogin",
- getenv ("CONSOLE"), (char *) NULL, newenv);
+ execle ("/sbin/sulogin", "/sbin/sulogin", (char *) NULL, newenv);
eerrorx ("%s: unable to exec `/sbin/sulogin': %s", applet, strerror (errno));
#else
exit (EXIT_SUCCESS);