X-Git-Url: http://git.grml.org/?p=grml-scripts.git;a=blobdiff_plain;f=compile%2Fgrml-runtty.c;fp=compile%2Fgrml-runtty.c;h=dbd02735b2b9b36f3c080cfb1d3285bce85fd6b5;hp=56dcd52fb0feb04b800a360713fa287ac6f2c66a;hb=03d7a140777598aee0694562425f1270bed242b0;hpb=513039813fada72f1c659094ea1c96a040184d5d 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);