diff --git a/main.cpp b/main.cpp index b425a1f..958bebb 100644 --- a/main.cpp +++ b/main.cpp @@ -71,27 +71,18 @@ int main(int argc, char *argv[]) if(execCmd.isEmpty()) { execCmd = settings->value("general/execCmd").toString(); } - if(execCmd.isEmpty()) { - // execute the user's default shell - passwd *pwdstruct = getpwuid(getuid()); - execCmd = QString(pwdstruct->pw_shell); - execCmd.append(" --login"); - } delete settings; // don't need 'em here - QStringList execParts = execCmd.split(' ', QString::SkipEmptyParts); - if(execParts.length()==0) - exit(0); - char *ptrs[execParts.length()+1]; - for(int i=0; ipw_shell; + if (execCmd.isEmpty()) { + // execute the user's default shell + execl(shell, shell, "--login", (char*)NULL); + } else { + execl(shell, shell, "-c", qPrintable(execCmd), (char*)NULL); } - ptrs[execParts.length()] = 0; - execvp(execParts.first().toLatin1(), ptrs); exit(0); }