static void
-log(const char *ctl, ...)
+crondlog(const char *ctl, ...)
{
va_list va;
int level = (int)(ctl[0] & 0xf);
* of 1 second.
*/
- log("\011%s " VERSION " dillon, started, log level %d\n", bb_applet_name,
+ crondlog("\011%s " VERSION " dillon, started, log level %d\n", bb_applet_name,
LogLevel);
SynchronizeDir();
CheckUpdates();
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt)
- log("\005Wakeup dt=%d\n", dt);
+ crondlog("\005Wakeup dt=%d\n", dt);
#endif
if (dt < -60*60 || dt > 60*60) {
t1 = t2;
- log("\111time disparity of %d minutes detected\n", dt / 60);
+ crondlog("\111time disparity of %d minutes detected\n", dt / 60);
} else if (dt > 0) {
TestJobs(t1, t2);
RunJobs();
*/
if ((pas = getpwnam(user)) == 0) {
- log("\011failed to get uid for %s", user);
+ crondlog("\011failed to get uid for %s", user);
return(-1);
}
setenv("USER", pas->pw_name, 1);
*/
if (initgroups(user, pas->pw_gid) < 0) {
- log("\011initgroups failed: %s %m", user);
+ crondlog("\011initgroups failed: %s %m", user);
return(-1);
}
/* drop all priviledges */
if (setgid(pas->pw_gid) < 0) {
- log("\011setgid failed: %s %d", user, pas->pw_gid);
+ crondlog("\011setgid failed: %s %d", user, pas->pw_gid);
return(-1);
}
if (setuid(pas->pw_uid) < 0) {
- log("\011setuid failed: %s %d", user, pas->pw_uid);
+ crondlog("\011setuid failed: %s %d", user, pas->pw_uid);
return(-1);
}
if (chdir(pas->pw_dir) < 0) {
- log("\011chdir failed: %s: %m", pas->pw_dir);
+ crondlog("\011chdir failed: %s: %m", pas->pw_dir);
if (chdir(TMPDIR) < 0) {
- log("\011chdir failed: %s: %m", TMPDIR);
+ crondlog("\011chdir failed: %s: %m", TMPDIR);
return(-1);
}
}
*/
if (skip == 0) {
- log("\111failed user %s parsing %s\n", user, base);
+ crondlog("\111failed user %s parsing %s\n", user, base);
return(NULL);
}
if (*ptr == '-' && n2 < 0) {
} while (n1 != n2 && --failsafe);
if (failsafe == 0) {
- log("\111failed user %s parsing %s\n", user, base);
+ crondlog("\111failed user %s parsing %s\n", user, base);
return(NULL);
}
}
}
if (*ptr != ' ' && *ptr != '\t' && *ptr != '\n') {
- log("\111failed user %s parsing %s\n", user, base);
+ crondlog("\111failed user %s parsing %s\n", user, base);
return(NULL);
}
int i;
for (i = 0; i < modvalue; ++i)
- log("\005%d", ary[i]);
- log("\005\n");
+ crondlog("\005%d", ary[i]);
+ crondlog("\005\n");
}
#endif
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt)
- log("\111User %s Entry %s\n", fileName, buf);
+ crondlog("\111User %s Entry %s\n", fileName, buf);
#endif
/*
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt) {
- log("\111 Command %s\n", ptr);
+ crondlog("\111 Command %s\n", ptr);
}
#endif
FileBase = file;
if (maxLines == 0 || maxEntries == 0)
- log("\111Maximum number of lines reached for user %s\n", fileName);
+ crondlog("\111Maximum number of lines reached for user %s\n", fileName);
}
fclose(fi);
}
remove(CRONUPDATE);
if (chdir(CDir) < 0) {
- log("\311unable to find %s\n", CDir);
+ crondlog("\311unable to find %s\n", CDir);
}
{
DIR *dir;
if (getpwnam(den->d_name))
SynchronizeFile(den->d_name);
else
- log("\007ignoring %s\n", den->d_name);
+ crondlog("\007ignoring %s\n", den->d_name);
}
closedir(dir);
} else {
- log("\311Unable to open current dir!\n");
+ crondlog("\311Unable to open current dir!\n");
}
}
}
for (file = FileBase; file; file = file->cf_Next) {
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt)
- log("\005FILE %s:\n", file->cf_User);
+ crondlog("\005FILE %s:\n", file->cf_User);
#endif
if (file->cf_Deleted)
continue;
for (line = file->cf_LineBase; line; line = line->cl_Next) {
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt)
- log("\005 LINE %s\n", line->cl_Shell);
+ crondlog("\005 LINE %s\n", line->cl_Shell);
#endif
if (line->cl_Mins[tp->tm_min] &&
line->cl_Hrs[tp->tm_hour] &&
) {
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt)
- log("\005 JobToDo: %d %s\n", line->cl_Pid, line->cl_Shell);
+ crondlog("\005 JobToDo: %d %s\n", line->cl_Pid, line->cl_Shell);
#endif
if (line->cl_Pid > 0) {
- log("\010 process already running: %s %s\n",
+ crondlog("\010 process already running: %s %s\n",
file->cf_User,
line->cl_Shell
);
RunJob(file->cf_User, line);
- log("\010USER %s pid %3d cmd %s\n",
+ crondlog("\010USER %s pid %3d cmd %s\n",
file->cf_User,
line->cl_Pid,
line->cl_Shell
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt)
- log("\005Child Running %s\n", prog);
+ crondlog("\005Child Running %s\n", prog);
#endif
if (mailFd >= 0) {
close(mailFd);
}
execl(prog, prog, cmd, arg, NULL);
- log("\024unable to exec, user %s cmd %s %s %s\n", user,
+ crondlog("\024unable to exec, user %s cmd %s %s %s\n", user,
prog, cmd, arg);
if(mailf)
fdprintf(1, "Exec failed: %s -c %s\n", prog, arg);
/*
* FORK FAILED
*/
- log("\024couldn't fork, user %s\n", user);
+ crondlog("\024couldn't fork, user %s\n", user);
line->cl_Pid = 0;
if(mailf)
remove(mailf);
line->cl_Shell);
line->cl_MailPos = lseek(mailFd, 0, 1);
} else {
- log("\024unable to create mail file user %s file %s, output to /dev/null\n",
+ crondlog("\024unable to create mail file user %s file %s, output to /dev/null\n",
user, mailFile);
}
#ifdef FEATURE_DEBUG_OPT
if (DebugOpt)
- log("\005Child Running %s\n", def_sh);
+ crondlog("\005Child Running %s\n", def_sh);
#endif
execl(def_sh, def_sh, "-c", line->cl_Shell, NULL);
- log("\024unable to exec, user %s cmd %s -c %s\n", user,
+ crondlog("\024unable to exec, user %s cmd %s -c %s\n", user,
def_sh, line->cl_Shell);
exit(0);
} else if (pid < 0) {
/*
* FORK FAILED
*/
- log("\024couldn't fork, user %s\n", user);
+ crondlog("\024couldn't fork, user %s\n", user);
pid = 0;
}
line->cl_Pid = pid;