// process still/already running...
return false;
}
+
+ Utils::FileStat stat(m_path);
+ if (! stat.is_exec_file())
+ {
+ // command to execute does not exist or is not executable
+ return false;
+ }
+
m_exit_code= 0;
if (stderr == _StderrOnStdout)
if (r !=0 )
{
//TODO?
- exit(255);
+ _exit(255);
}
}
// execute:
execv(m_path.c_str(), argv);
// exit if exec failed
- exit(255);
+ _exit(255);
//cleanup! ... just joking; we exec or we exit, in either case the system cleans
// everything which needs to be cleaned up.
+ // Using _exit instead of exit, it will not clean up the clone of parent's memory
+ // in case of failure to exec m_path
}
return false; // keep the compiler happy...
} // eo ProcessImplementation::startProcess()
m_is_fifo= S_ISFIFO(file_stat->st_mode);
m_is_symbolic_link= S_ISLNK(file_stat->st_mode);
m_is_socket= S_ISSOCK(file_stat->st_mode);
+ m_is_exec_file = m_is_regular_file && (file_stat->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH));
// TODO: implement more!
} // end of FileStat::refresh()
bool is_symbolic_link() const { return m_is_symbolic_link; }
bool is_link() const { return m_is_symbolic_link; }
bool is_socket() const { return m_is_socket; }
+ bool is_exec_file() const { return m_is_exec_file; }
private:
std::string m_path;
bool m_is_fifo :1;
bool m_is_symbolic_link :1;
bool m_is_socket :1;
+ bool m_is_exec_file :1;
}; // end of FileStat