aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-01-24 17:13:16 (GMT)
committermarkt <markt>2007-01-24 17:13:16 (GMT)
commit69bac5d56ff60dfce108e3a25270aab8eaf2b345 (patch)
treeabe9e8e3a25698e55478bc9844c48b6880e50d57 /src
parenta5ee8e9d91b30081b80d0dc622a774482a3612c9 (diff)
downloadfluxbox_paul-69bac5d56ff60dfce108e3a25270aab8eaf2b345.zip
fluxbox_paul-69bac5d56ff60dfce108e3a25270aab8eaf2b345.tar.bz2
detect shell from environment variable
Diffstat (limited to 'src')
-rw-r--r--src/FbCommands.cc8
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 ;)