diff --git a/ChangeLog b/ChangeLog index 8c67f62b..07a09d71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0.0: +*07/06/06: + * Fix to avoid rogue instances of /bin/sh after forking away programs (Mathias) + util/fbrun/FbRun.cc src/FbCommands.cc *07/06/04: * Fix fluxbox.1.in, and asciidoc, menu command is "wallpapers" not "wallpaper". asciidoc manpages are stale. diff --git a/src/FbCommands.cc b/src/FbCommands.cc index afa79841..42478205 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc @@ -154,9 +154,12 @@ int ExecuteCmd::run() { // remove last number of display and add screen num displaystring.erase(displaystring.size()-1); displaystring += intbuff; + + std::string exec_cmd = "exec " + m_cmd; + setsid(); putenv(const_cast(displaystring.c_str())); - execl(shell, shell, "-c", m_cmd.c_str(), static_cast(NULL)); + execl(shell, shell, "-c", exec_cmd.c_str(), static_cast(NULL)); exit(0); return pid; // compiler happy -> we are happy ;) diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc index 7797f769..95cb94dc 100644 --- a/util/fbrun/FbRun.cc +++ b/util/fbrun/FbRun.cc @@ -119,8 +119,15 @@ void FbRun::run(const std::string &command) { // fork and execute program if (!fork()) { + + char *shell = getenv("SHELL"); + if (!shell) + shell = "/bin/sh"; + + std::string exec_cmd = "exec " + command; + setsid(); - execl("/bin/sh", "/bin/sh", "-c", command.c_str(), static_cast(NULL)); + execl(shell, shell, "-c", exec_cmd.c_str(), static_cast(NULL)); exit(0); //exit child }