]> granicus.if.org Git - cronie/commitdiff
various files: fix indentation
authorSami Kerola <kerolasa@iki.fi>
Sat, 10 Jun 2017 21:33:53 +0000 (22:33 +0100)
committerTomáš Mráz <t8m@users.noreply.github.com>
Mon, 10 Jul 2017 16:13:14 +0000 (18:13 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/cron.c
src/cronnext.c
src/crontab.c
src/database.c
src/do_command.c
src/entry.c
src/env.c
src/misc.c
src/security.c

index def1298f354ee73f1ea59d67b84be378278bb079..4c18dc06f6ae682c067b2fbc39c1d09de569a135 100644 (file)
@@ -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);
 }
index 3d5ce63a49e8c74c25ddba19ee090232b190960b..47c983b4f7b5bf48d82e2cea3832981bd2ac5a60 100644 (file)
@@ -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;
 }
index b84c23bf45ddb3830ddfddfa86b41bf17fe7de35..c14255287489e957cee893969597b685e7ccab66 100644 (file)
@@ -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);
index 15eb2a25eabe73c9c362e04de491fa8d41399e9c..95c9b66f69b77e42f91d3808ffe120d3a566b9e7 100644 (file)
@@ -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) {
index ce80403623009846060105675e0a64cc938716fd..21f16beb627d77f0f77a28cec6e79002b8958e50 100644 (file)
@@ -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;
 }
index ce3775692e583956fb51e3dda3f685de28b110f7..1eb1e1d66a9ce30a60bd129aab876efc0a2ed9a1 100644 (file)
@@ -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);
 }
 
 
index 6361ba09a6c492393393df8e7efa747ebe4fa5dc..4a9051a19b86858f2ed5a77a45cb7f6110b75e1e 100644 (file)
--- 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';
index 01df75a3c19a75fd1b3587bb32a69659b7a96668..4b9d20ff441a1b04d0618847bc398915b5e9d03d 100644 (file)
@@ -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();
index 2c668c4e84eb1b867acdf257163579530a896976..687c26f881e0c272843b0bc0be38fd189763a741 100644 (file)
@@ -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 = {