diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FbCommands.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 83025ec..5fbceab 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -143,12 +143,18 @@ int ExecuteCmd::run() { | |||
143 | 143 | ||
144 | sprintf(intbuff, "%d", screen_num); | 144 | sprintf(intbuff, "%d", screen_num); |
145 | 145 | ||
146 | // get shell path from the environment | ||
147 | // this process exits immediately, so we don't have to worry about memleaks | ||
148 | char *shell = getenv("SHELL"); | ||
149 | if (!shell) | ||
150 | shell = "/bin/sh"; | ||
151 | |||
146 | // remove last number of display and add screen num | 152 | // remove last number of display and add screen num |
147 | displaystring.erase(displaystring.size()-1); | 153 | displaystring.erase(displaystring.size()-1); |
148 | displaystring += intbuff; | 154 | displaystring += intbuff; |
149 | setsid(); | 155 | setsid(); |
150 | putenv(const_cast<char *>(displaystring.c_str())); | 156 | putenv(const_cast<char *>(displaystring.c_str())); |
151 | execl("/bin/sh", "/bin/sh", "-c", m_cmd.c_str(), static_cast<void*>(NULL)); | 157 | execl(shell, shell, "-c", m_cmd.c_str(), static_cast<void*>(NULL)); |
152 | exit(0); | 158 | exit(0); |
153 | 159 | ||
154 | return pid; // compiler happy -> we are happy ;) | 160 | return pid; // compiler happy -> we are happy ;) |