From: Sami Kerola Date: Sat, 10 Jun 2017 21:33:53 +0000 (+0100) Subject: various files: fix indentation X-Git-Tag: cronie-1.5.2~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea745d24f15899df44613be88321e803b02e9249;p=cronie various files: fix indentation Signed-off-by: Sami Kerola --- diff --git a/src/cron.c b/src/cron.c index def1298..4c18dc0 100644 --- a/src/cron.c +++ b/src/cron.c @@ -555,13 +555,13 @@ static void find_jobs(int vtime, cron_db * db, int doWild, int doNonWild, long v 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; @@ -672,15 +672,15 @@ static void sigchld_reaper(void) { 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); } diff --git a/src/cronnext.c b/src/cronnext.c index 3d5ce63..47c983b 100644 --- a/src/cronnext.c +++ b/src/cronnext.c @@ -315,12 +315,11 @@ int main(int argn, char *argv[]) { 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; } diff --git a/src/crontab.c b/src/crontab.c index b84c23b..c142552 100644 --- a/src/crontab.c +++ b/src/crontab.c @@ -564,10 +564,10 @@ static void edit_cmd(void) { 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; @@ -913,7 +913,7 @@ static int hostset_cmd(void) { 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); diff --git a/src/database.c b/src/database.c index 15eb2a2..95c9b66 100644 --- a/src/database.c +++ b/src/database.c @@ -252,7 +252,7 @@ process_crontab(const char *uname, const char *fname, const char *tabname, */ 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; } @@ -280,7 +280,7 @@ process_crontab(const char *uname, const char *fname, const char *tabname, next_crontab: if (crontab_fd != -1) { Debug(DLOAD, (" [done]\n")); - close(crontab_fd); + close(crontab_fd); } } @@ -584,7 +584,7 @@ int load_database(cron_db * old_db) { 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) { diff --git a/src/do_command.c b/src/do_command.c index ce80403..21f16be 100644 --- a/src/do_command.c +++ b/src/do_command.c @@ -110,10 +110,10 @@ static int child_process(entry * e, char **jobenv) { 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++) @@ -568,18 +568,18 @@ static int child_process(entry * e, char **jobenv) { 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; } diff --git a/src/entry.c b/src/entry.c index ce37756..1eb1e1d 100644 --- a/src/entry.c +++ b/src/entry.c @@ -103,7 +103,7 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw, Debug(DPARS, ("load_entry()...about to eat comments\n")); - skip_comments(file); + skip_comments(file); ch = get_char(file); if (ch == EOF) @@ -277,10 +277,10 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw, 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; } @@ -440,11 +440,11 @@ get_list(bitstr_t * bits, int low, int high, const char *names[], 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 */ @@ -461,11 +461,11 @@ get_list(bitstr_t * bits, int low, int high, const char *names[], /* 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); } diff --git a/src/env.c b/src/env.c index 6361ba0..4a9051a 100644 --- a/src/env.c +++ b/src/env.c @@ -191,8 +191,9 @@ int load_env(char *envstr, FILE * f) { 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'; diff --git a/src/misc.c b/src/misc.c index 01df75a..4b9d20f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -315,7 +315,8 @@ void acquire_daemonlock(int closeflag) { 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; @@ -382,7 +383,7 @@ int get_char(FILE * file) { ch = getc(file); if (ch == '\n') Set_LineNum(LineNumber + 1) - return (ch); + return (ch); } /* unget_char(ch, file) : like ungetc but do LineNumber processing @@ -714,8 +715,8 @@ char *arpadate(time_t *clock) { #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(); diff --git a/src/security.c b/src/security.c index 2c668c4..687c26f 100644 --- a/src/security.c +++ b/src/security.c @@ -57,21 +57,21 @@ cron_conv(int num_msg, const struct pam_message **msgm, 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 = {