From 03d7a140777598aee0694562425f1270bed242b0 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Fri, 14 Oct 2011 12:08:47 +0200 Subject: [PATCH] grml-runtty MUST set PATH --- compile/grml-runtty.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compile/grml-runtty.c b/compile/grml-runtty.c index 56dcd52..dbd0273 100644 --- a/compile/grml-runtty.c +++ b/compile/grml-runtty.c @@ -88,10 +88,10 @@ int main(int argc, char* argv[]) { prog = argv[2]; user = argv[3]; - openlog("startprog", LOG_CONS | LOG_PID, LOG_AUTHPRIV); + openlog("grml-runtty", LOG_CONS | LOG_PID, LOG_AUTHPRIV); if (tty == NULL || prog == NULL || user == NULL) - error("Usage: startprog /dev/ttyX /bin/bash user", 1); + error("Usage: grml-runtty /dev/ttyX /bin/bash user", 1); pw = getpwnam(user); if (!pw) @@ -99,6 +99,11 @@ int main(int argc, char* argv[]) { clearenv(); putenv("TERM=linux"); + if (pw->pw_uid == 0) { + putenv("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"); + } else { + putenv("PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"); + } setenvvar("TTY", tty); setenvvar("USER", pw->pw_name); setenvvar("LOGNAME", pw->pw_name); -- 2.1.4