Subversion Repositories public

Compare Revisions

Ignore whitespace Rev 50 → Rev 51

/incron/trunk/usertable.cpp
198,14 → 198,11
if (pd.pid == 0) {
struct passwd* pwd = getpwnam(m_user.c_str());
if (pwd == NULL)
if ( pwd == NULL // user not found
|| setuid(pwd->pw_uid) != 0 // setting UID failed
|| execvp(argv[0], argv) != 0) // exec failed
{
_exit(1);
if (setuid(pwd->pw_uid) != 0)
_exit(1);
if (execvp(argv[0], argv) != 0) {
_exit(1);
}
}
else if (pd.pid > 0) {
226,6 → 223,8
syslog(LOG_ERR, "cannot fork process: %s", strerror(errno));
}
CleanupArgs(argc, argv);
}
 
InCronTabEntry* UserTable::FindEntry(InotifyWatch* pWatch)
265,6 → 264,15
return true;
}
 
void UserTable::CleanupArgs(int argc, char** argv)
{
for (int i=0; i<argc; i++) {
delete[] argv[i];
}
delete[] argv;
}
 
void UserTable::FinishDone()
{
PROC_LIST::iterator it = s_procList.begin();