orig_tz = getenv("TZ");
- /* the dom/dow situation is odd. '* * 1,15 * Sun' will run on the
- * first and fifteenth AND every Sunday; '* * * * Sun' will run *only*
- * on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this
- * is why we keep 'e->dow_star' and 'e->dom_star'. yes, it's bizarre.
- * like many bizarre things, it's the standard.
- */
- for (u = db->head; u != NULL; u = u->next) {
+ /* the dom/dow situation is odd. '* * 1,15 * Sun' will run on the
+ * first and fifteenth AND every Sunday; '* * * * Sun' will run *only*
+ * on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this
+ * is why we keep 'e->dow_star' and 'e->dom_star'. yes, it's bizarre.
+ * like many bizarre things, it's the standard.
+ */
+ for (u = db->head; u != NULL; u = u->next) {
for (e = u->crontab; e != NULL; e = e->next) {
time_t virtualSecond = (vtime - e->delay) * SECONDS_PER_MINUTE;
time_t virtualGMTSecond = virtualSecond - vGMToff;
if (errno == EINTR)
continue;
Debug(DPROC, ("[%ld] sigchld...no children\n", (long) getpid()));
- break;
+ break;
case 0:
Debug(DPROC, ("[%ld] sigchld...no dead kids\n", (long) getpid()));
- break;
+ break;
default:
Debug(DPROC,
("[%ld] sigchld...pid #%ld died, stat=%d\n",
(long) getpid(), (long) pid, WEXITSTATUS(waiter)));
- break;
+ break;
}
} while (pid > 0);
}
printf("no job scheduled\n");
return EXIT_FAILURE;
}
+ else if (verbose)
+ printf("next of all jobs: %ld = %s",
+ (long) next, asctime(localtime(&next)));
else
- if (verbose)
- printf("next of all jobs: %ld = %s",
- (long)next, asctime(localtime(&next)));
- else
- printf("%ld\n", (long)next);
+ printf("%ld\n", (long) next);
return EXIT_SUCCESS;
}
perror(Filename);
exit(ERROR_EXIT);
}
- if (swap_uids() == -1) {
- perror("swapping uids");
- exit(ERROR_EXIT);
- }
+ if (swap_uids() == -1) {
+ perror("swapping uids");
+ exit(ERROR_EXIT);
+ }
/* Set it to 1970 */
utimebuf.actime = 0;
utimebuf.modtime = 0;
safename = host_specific_filename("#tmp", "XXXXXXXXXX");
if (!safename || !glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR,
- safename, '/')) {
+ safename, '/')) {
TempFilename[0] = '\0';
fprintf(stderr, "path too long\n");
return (-2);
*/
if (u->mtime == mtime) {
Debug(DLOAD, (" [no change, using old data]"));
- unlink_user(old_db, u);
+ unlink_user(old_db, u);
link_user(new_db, u);
goto next_crontab;
}
next_crontab:
if (crontab_fd != -1) {
Debug(DLOAD, (" [done]\n"));
- close(crontab_fd);
+ close(crontab_fd);
}
}
overwrite_database(old_db, &new_db);
Debug(DLOAD, ("load_database is done\n"));
- return 1;
+ return 1;
}
void link_user(cron_db * db, user * u) {
Debug(DPROC, ("[%ld] child_process('%s')\n", (long) getpid(), e->cmd));
#ifdef CAPITALIZE_FOR_PS
- /* mark ourselves as different to PS command watchers by upshifting
- * our program name. This has no effect on some kernels.
- */
- /*local */ {
+ /* mark ourselves as different to PS command watchers by upshifting
+ * our program name. This has no effect on some kernels.
+ */
+ /*local */ {
char *pch;
for (pch = ProgramName; *pch; pch++)
Debug(DPROC, ("[%ld] waiting for grandchild #%d to finish\n",
(long) getpid(), children));
- while ((child = wait(&waiter)) < OK && errno == EINTR) ;
+ while ((child = wait(&waiter)) < OK && errno == EINTR) ;
if (child < OK) {
Debug(DPROC,
("[%ld] no more grandchildren--mail written?\n",
(long) getpid()));
- break;
+ break;
}
Debug(DPROC, ("[%ld] grandchild #%ld finished, status=%04x",
(long) getpid(), (long) child, WEXITSTATUS(waiter)));
if (WIFSIGNALED(waiter) && WCOREDUMP(waiter))
- Debug(DPROC, (", dumped core"));
- Debug(DPROC, ("\n"));
+ Debug(DPROC, (", dumped core"));
+ Debug(DPROC, ("\n"));
}
return OK_EXIT;
}
Debug(DPARS, ("load_entry()...about to eat comments\n"));
- skip_comments(file);
+ skip_comments(file);
ch = get_char(file);
if (ch == EOF)
char *username = cmd; /* temp buffer */
Debug(DPARS, ("load_entry()...about to parse username\n"));
- ch = get_string(username, MAX_COMMAND, file, " \t\n");
+ ch = get_string(username, MAX_COMMAND, file, " \t\n");
Debug(DPARS, ("load_entry()...got %s\n", username));
- if (ch == EOF || ch == '\n' || ch == '*') {
+ if (ch == EOF || ch == '\n' || ch == '*') {
ecode = e_cmd;
goto eof;
}
Debug(DPARS | DEXT, ("get_list()...entered\n"));
- /* list = range {"," range}
- */
- /* clear the bit string, since the default is 'off'.
- */
- bit_nclear(bits, 0, (high - low));
+ /* list = range {"," range}
+ */
+ /* clear the bit string, since the default is 'off'.
+ */
+ bit_nclear(bits, 0, (high - low));
/* process all ranges
*/
/* exiting. skip to some blanks, then skip over the blanks.
*/
Skip_Nonblanks(ch, file)
- Skip_Blanks(ch, file)
+ Skip_Blanks(ch, file)
- Debug(DPARS | DEXT, ("get_list()...exiting w/ %02x\n", ch));
+ Debug(DPARS | DEXT, ("get_list()...exiting w/ %02x\n", ch));
- return (ch);
+ return (ch);
}
Debug(DPARS, ("load_env, read <%s>\n", envstr));
- memset(name, 0, sizeof name);
+ memset(name, 0, sizeof name);
memset(val, 0, sizeof val);
+
str = name;
state = NAMEI;
quotechar = '\0';
return;
}
- if(NoFork == 1) return; //move along, nothing to do here...
+ if (NoFork == 1)
+ return; //move along, nothing to do here...
if (fd == -1) {
pidfile = _PATH_CRON_PID;
ch = getc(file);
if (ch == '\n')
Set_LineNum(LineNumber + 1)
- return (ch);
+ return (ch);
}
/* unget_char(ch, file) : like ungetc but do LineNumber processing
#endif /*MAIL_DATE */
#ifdef HAVE_SAVED_UIDS
- static uid_t save_euid;
- static gid_t save_egid;
+static uid_t save_euid;
+static gid_t save_egid;
int swap_uids(void) {
save_egid = getegid();
struct pam_response **response ATTRIBUTE_UNUSED,
void *appdata_ptr ATTRIBUTE_UNUSED)
{
- int i;
-
- for (i = 0; i < num_msg; i++) {
- switch (msgm[i]->msg_style) {
- case PAM_ERROR_MSG:
- case PAM_TEXT_INFO:
- if (msgm[i]->msg != NULL) {
- log_it("CRON", getpid(), "pam_message", msgm[i]->msg, 0);
- }
- break;
- default:
- break;
- }
- }
- return (0);
+ int i;
+
+ for (i = 0; i < num_msg; i++) {
+ switch (msgm[i]->msg_style) {
+ case PAM_ERROR_MSG:
+ case PAM_TEXT_INFO:
+ if (msgm[i]->msg != NULL) {
+ log_it("CRON", getpid(), "pam_message", msgm[i]->msg, 0);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return (0);
}
static const struct pam_conv conv = {