]> granicus.if.org Git - cronie/commitdiff
debuging: make Debug macro look like function
authorSami Kerola <kerolasa@iki.fi>
Sat, 24 Nov 2012 20:06:13 +0000 (20:06 +0000)
committerTomas Mraz <tmraz@fedoraproject.org>
Mon, 26 Nov 2012 16:25:36 +0000 (17:25 +0100)
This will make indent(1) program not to think it is a clause.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/cron.c
src/crontab.c
src/database.c
src/do_command.c
src/entry.c
src/env.c
src/macros.h
src/security.c
src/user.c

index 47444a23ec68679fd6fe843e9efb72ce2561e87d..08e164dc611baca24a07e709d13a7f22cb4f89aa 100644 (file)
@@ -387,7 +387,7 @@ int main(int argc, char *argv[]) {
                                 * minute until caught up.
                                 */
                                Debug(DSCH, ("[%ld], normal case %d minutes to go\n",
-                                               (long) pid, timeDiff))
+                                               (long) pid, timeDiff));
                                do {
                                        if (job_runqueue())
                                                sleep(10);
@@ -412,7 +412,7 @@ int main(int argc, char *argv[]) {
                                 * housekeeping.
                                 */
                                Debug(DSCH, ("[%ld], DST begins %d minutes to go\n",
-                                               (long) pid, timeDiff))
+                                               (long) pid, timeDiff));
                                /* run wildcard jobs for current minute */
                                find_jobs(timeRunning, &database, TRUE, FALSE, GMToff);
 
@@ -439,7 +439,7 @@ int main(int argc, char *argv[]) {
                                 * change until we are caught up.
                                 */
                                Debug(DSCH, ("[%ld], DST ends %d minutes to go\n",
-                                               (long) pid, timeDiff))
+                                               (long) pid, timeDiff));
                                find_jobs(timeRunning, &database, TRUE, FALSE, GMToff);
                                break;
                        default:
@@ -447,7 +447,7 @@ int main(int argc, char *argv[]) {
                                 * other: time has changed a *lot*,
                                 * jump virtual time, and run everything
                                 */
-                               Debug(DSCH, ("[%ld], clock jumped\n", (long) pid))
+                               Debug(DSCH, ("[%ld], clock jumped\n", (long) pid));
                                virtualTime = timeRunning;
                                oldGMToff = GMToff;
                                find_jobs(timeRunning, &database, TRUE, TRUE, GMToff);
@@ -541,7 +541,7 @@ static void find_jobs(int vtime, cron_db * db, int doWild, int doNonWild, long v
 
        Debug(DSCH, ("[%ld] tick(%d,%d,%d,%d,%d) %s %s\n",
                        (long) getpid(), minute, hour, dom, month, dow,
-                       doWild ? " " : "No wildcard", doNonWild ? " " : "Wildcard only"))
+                       doWild ? " " : "No wildcard", doNonWild ? " " : "Wildcard only"));
                /* 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
@@ -552,7 +552,7 @@ static void find_jobs(int vtime, cron_db * db, int doWild, int doNonWild, long v
                for (e = u->crontab; e != NULL; e = e->next) {
                        Debug(DSCH | DEXT, ("user [%s:%ld:%ld:...] cmd=\"%s\"\n",
                                        e->pwd->pw_name, (long) e->pwd->pw_uid,
-                                       (long) e->pwd->pw_gid, e->cmd))
+                                       (long) e->pwd->pw_gid, e->cmd));
                                uname = e->pwd->pw_name;
                        /* check if user exists in time of job is being run f.e. ldap */
                        if (getpwnam(uname) != NULL) {
@@ -603,7 +603,7 @@ static void set_time(int initialize) {
        if (initialize || tm.tm_isdst != isdst) {
                isdst = tm.tm_isdst;
                GMToff = get_gmtoff(&StartTime, &tm);
-               Debug(DSCH, ("[%ld] GMToff=%ld\n", (long) getpid(), (long) GMToff))
+               Debug(DSCH, ("[%ld] GMToff=%ld\n", (long) getpid(), (long) GMToff));
        }
        clockTime = (StartTime + GMToff) / (time_t) SECONDS_PER_MINUTE;
 }
@@ -619,7 +619,7 @@ static void cron_sleep(int target, cron_db * db) {
        seconds_to_wait = (int) (target * SECONDS_PER_MINUTE - t1) + 1;
        Debug(DSCH, ("[%ld] Target time=%ld, sec-to-wait=%d\n",
                        (long) getpid(), (long) target * SECONDS_PER_MINUTE,
-                       seconds_to_wait))
+                       seconds_to_wait));
 
        while (seconds_to_wait > 0 && seconds_to_wait < 65) {
                sleep((unsigned int) seconds_to_wait);
@@ -662,15 +662,15 @@ static void sigchld_reaper(void) {
                case -1:
                        if (errno == EINTR)
                                continue;
-                       Debug(DPROC, ("[%ld] sigchld...no children\n", (long) getpid()))
+                       Debug(DPROC, ("[%ld] sigchld...no children\n", (long) getpid()));
                                break;
                case 0:
-                       Debug(DPROC, ("[%ld] sigchld...no dead kids\n", (long) getpid()))
+                       Debug(DPROC, ("[%ld] sigchld...no dead kids\n", (long) getpid()));
                                break;
                default:
                        Debug(DPROC,
                                ("[%ld] sigchld...pid #%ld died, stat=%d\n",
-                                       (long) getpid(), (long) pid, WEXITSTATUS(waiter)))
+                                       (long) getpid(), (long) pid, WEXITSTATUS(waiter)));
                                break;
                }
        } while (pid > 0);
index ce4664d87d6f5568bf4d766ecc59532bf2b305e2..29c1967cd336f4abb9ea298474f2ff774c330dd8 100644 (file)
@@ -365,7 +365,7 @@ static void parse_args(int argc, char *argv[]) {
        }
 
        Debug(DMISC, ("user=%s, file=%s, option=%s\n",
-                       User, Filename, Options[(int) Option]))
+                       User, Filename, Options[(int) Option]));
 }
 
 static void list_cmd(void) {
index c3b922f5236d28c9f2e3febee3a778cdab8cd712..61764d70a80295b57066d7672a454fb7685be1cb 100644 (file)
@@ -206,7 +206,7 @@ process_crontab(const char *uname, const char *fname, const char *tabname,
        if ((crontab_fd = check_open(tabname, uname, pw, &mtime)) == -1)
                goto next_crontab;
 
-       Debug(DLOAD, ("\t%s:", fname))
+       Debug(DLOAD, ("\t%s:", fname));
 
        if (old_db != NULL)
                u = find_user(old_db, fname, crond_crontab ? tabname : NULL);   /* find user in old_db */
@@ -216,7 +216,7 @@ process_crontab(const char *uname, const char *fname, const char *tabname,
                 * in, then we can just use our existing entry.
                 */
                if (u->mtime == mtime) {
-                       Debug(DLOAD, (" [no change, using old data]"))
+                       Debug(DLOAD, (" [no change, using old data]"));
                                unlink_user(old_db, u);
                        link_user(new_db, u);
                        goto next_crontab;
@@ -229,7 +229,7 @@ process_crontab(const char *uname, const char *fname, const char *tabname,
                 * users will be deleted from the old database when
                 * we finish with the crontab...
                 */
-               Debug(DLOAD, (" [delete old data]"))
+               Debug(DLOAD, (" [delete old data]"));
                        unlink_user(old_db, u);
                free_user(u);
                log_it(fname, getpid(), "RELOAD", tabname, 0);
@@ -244,7 +244,7 @@ process_crontab(const char *uname, const char *fname, const char *tabname,
 
   next_crontab:
        if (crontab_fd != -1) {
-               Debug(DLOAD, (" [done]\n"))
+               Debug(DLOAD, (" [done]\n"));
                        close(crontab_fd);
        }
 }
@@ -393,7 +393,7 @@ void check_inotify_database(cron_db * old_db) {
        }
 
        overwrite_database(old_db, &new_db);
-       Debug(DLOAD, ("check_inotify_database is done\n"))
+       Debug(DLOAD, ("check_inotify_database is done\n"));
 }
 #endif
 
@@ -401,9 +401,9 @@ static void overwrite_database(cron_db * old_db, cron_db * new_db) {
        user *u, *nu;
        /* whatever's left in the old database is now junk.
         */
-       Debug(DLOAD, ("unlinking old database:\n"))
+       Debug(DLOAD, ("unlinking old database:\n"));
                for (u = old_db->head; u != NULL; u = nu) {
-               Debug(DLOAD, ("\t%s\n", u->name))
+               Debug(DLOAD, ("\t%s\n", u->name));
                        nu = u->next;
                unlink_user(old_db, u);
                free_user(u);
@@ -422,7 +422,7 @@ int load_database(cron_db * old_db) {
        pid_t pid = getpid();
        int is_local = 0;
 
-       Debug(DLOAD, ("[%ld] load_database()\n", (long) pid))
+       Debug(DLOAD, ("[%ld] load_database()\n", (long) pid));
 
                /* before we start loading any data, do a stat on SPOOL_DIR
                 * so that if anything changes as of this moment (i.e., before we've
@@ -466,7 +466,7 @@ int load_database(cron_db * old_db) {
                        TMAX(statbuf.st_mtime, syscron_stat.st_mtime))
                ) {
                Debug(DLOAD, ("[%ld] spool dir mtime unch, no load needed.\n",
-                               (long) pid))
+                               (long) pid));
                        return 0;
        }
 
@@ -541,7 +541,7 @@ int load_database(cron_db * old_db) {
        endpwent();
 
        overwrite_database(old_db, &new_db);
-       Debug(DLOAD, ("load_database is done\n"))
+       Debug(DLOAD, ("load_database is done\n"));
                return 1;
 }
 
index d1c834a37be3aa530e868ff8d9392a73017224dc..20f6116792d1031ed8887c7363ced4a8f4fc4b62 100644 (file)
@@ -50,7 +50,7 @@ void do_command(entry * e, user * u) {
 
        Debug(DPROC, ("[%ld] do_command(%s, (%s,%ld,%ld))\n",
                        (long) pid, e->cmd, u->name,
-                       (long) e->pwd->pw_uid, (long) e->pwd->pw_gid))
+                       (long) e->pwd->pw_uid, (long) e->pwd->pw_gid));
 
                /* fork to become asynchronous -- parent process is done immediately,
                 * and continues to run the normal cron code, which means return to
@@ -74,14 +74,14 @@ void do_command(entry * e, user * u) {
                ev = child_process(e, jobenv);
                cron_close_pam();
                env_free(jobenv);
-               Debug(DPROC, ("[%ld] child process done, exiting\n", (long) getpid()))
+               Debug(DPROC, ("[%ld] child process done, exiting\n", (long) getpid()));
                _exit(ev);
                break;
        default:
                /* parent process */
                break;
        }
-       Debug(DPROC, ("[%ld] main process returning to work\n", (long) pid))
+       Debug(DPROC, ("[%ld] main process returning to work\n", (long) pid));
 }
 
 static int child_process(entry * e, char **jobenv) {
@@ -106,7 +106,7 @@ static int child_process(entry * e, char **jobenv) {
        sigaction(SIGCHLD, &sa, NULL);
 
 
-       Debug(DPROC, ("[%ld] child_process('%s')\n", (long) getpid(), e->cmd))
+       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.
@@ -182,7 +182,7 @@ static int child_process(entry * e, char **jobenv) {
                return ERROR_EXIT;
                /*NOTREACHED*/
        case 0:
-               Debug(DPROC, ("[%ld] grandchild process fork()'ed\n", (long) getpid()))
+               Debug(DPROC, ("[%ld] grandchild process fork()'ed\n", (long) getpid()));
 
                /* write a log message.  we've waited this long to do it
                 * because it was not until now that we knew the PID that
@@ -262,7 +262,7 @@ static int child_process(entry * e, char **jobenv) {
         * the user's command.
         */
 
-       Debug(DPROC, ("[%ld] child continues, closing pipes\n", (long) getpid()))
+       Debug(DPROC, ("[%ld] child continues, closing pipes\n", (long) getpid()));
 
        /* close the ends of the pipe that will only be referenced in the
         * grandchild process...
@@ -288,7 +288,7 @@ static int child_process(entry * e, char **jobenv) {
                int ch;
 
                Debug(DPROC, ("[%ld] child2 sending data to grandchild\n",
-                               (long) getpid()))
+                               (long) getpid()));
 
                /* reset the SIGPIPE back to default so the child will terminate
                 * if it tries to write to a closed pipe
@@ -334,7 +334,7 @@ static int child_process(entry * e, char **jobenv) {
                fclose(out);
 
                Debug(DPROC, ("[%ld] child2 done sending to grandchild\n",
-                               (long) getpid()))
+                               (long) getpid()));
                _exit(0);
        }
 
@@ -353,7 +353,7 @@ static int child_process(entry * e, char **jobenv) {
         */
 
        Debug(DPROC, ("[%ld] child reading output from grandchild\n",
-                       (long) getpid()))
+                       (long) getpid()));
 
        /*local */  {
                FILE *in = fdopen(stdout_pipe[READ_PIPE], "r");
@@ -374,7 +374,7 @@ static int child_process(entry * e, char **jobenv) {
 
                        Debug(DPROC | DEXT,
                                ("[%ld] got data (%x:%c) from grandchild\n",
-                                       (long) getpid(), ch, ch))
+                                       (long) getpid(), ch, ch));
 
                                /* get name of recipient.  this is MAILTO if set to a
                                 * valid local username; USER otherwise.
@@ -513,7 +513,7 @@ static int child_process(entry * e, char **jobenv) {
                         */
 
                        if (mail) {
-                               Debug(DPROC, ("[%ld] closing pipe to mail\n", (long) getpid()))
+                               Debug(DPROC, ("[%ld] closing pipe to mail\n", (long) getpid()));
                                        /* Note: the pclose will probably see
                                         * the termination of the grandchild
                                         * in addition to the mail process, since
@@ -546,7 +546,7 @@ static int child_process(entry * e, char **jobenv) {
 
                }       /*if data from grandchild */
 
-               Debug(DPROC, ("[%ld] got EOF from grandchild\n", (long) getpid()))
+               Debug(DPROC, ("[%ld] got EOF from grandchild\n", (long) getpid()));
 
                fclose(in);     /* also closes stdout_pipe[READ_PIPE] */
        }
@@ -558,19 +558,19 @@ static int child_process(entry * e, char **jobenv) {
                PID_T child;
 
                Debug(DPROC, ("[%ld] waiting for grandchild #%d to finish\n",
-                               (long) getpid(), children))
+                               (long) getpid(), children));
                        while ((child = wait(&waiter)) < OK && errno == EINTR) ;
                if (child < OK) {
                        Debug(DPROC,
                                ("[%ld] no more grandchildren--mail written?\n",
-                                       (long) getpid()))
+                                       (long) getpid()));
                                break;
                }
                Debug(DPROC, ("[%ld] grandchild #%ld finished, status=%04x",
-                               (long) getpid(), (long) child, WEXITSTATUS(waiter)))
+                               (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 78c8a8516360ab516cde144afc1f9b06543efa89..0b482b91c6beabc3fb075fa53cbde534ca163af3 100644 (file)
@@ -98,7 +98,7 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
        char envstr[MAX_ENVSTR];
        char **tenvp;
 
-       Debug(DPARS, ("load_entry()...about to eat comments\n"))
+       Debug(DPARS, ("load_entry()...about to eat comments\n"));
 
                skip_comments(file);
 
@@ -202,7 +202,7 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
                }
        }
        else {
-               Debug(DPARS, ("load_entry()...about to parse numerics\n"))
+               Debug(DPARS, ("load_entry()...about to parse numerics\n"));
 
                if (ch == '*')
                        e->flags |= MIN_STAR;
@@ -273,10 +273,10 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
        if (!pw) {
                char *username = cmd;   /* temp buffer */
 
-               Debug(DPARS, ("load_entry()...about to parse username\n"))
+               Debug(DPARS, ("load_entry()...about to parse username\n"));
                        ch = get_string(username, MAX_COMMAND, file, " \t\n");
 
-               Debug(DPARS, ("load_entry()...got %s\n", username))
+               Debug(DPARS, ("load_entry()...got %s\n", username));
                        if (ch == EOF || ch == '\n' || ch == '*') {
                        ecode = e_cmd;
                        goto eof;
@@ -288,7 +288,7 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
                        goto eof;
                }
                Debug(DPARS, ("load_entry()...uid %ld, gid %ld\n",
-                               (long) pw->pw_uid, (long) pw->pw_gid))
+                               (long) pw->pw_uid, (long) pw->pw_gid));
        }
 
        if ((e->pwd = pw_dup(pw)) == NULL) {
@@ -361,7 +361,7 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
                log_it("CRON", getpid(), "ERROR", "can't set USER", 0);
 #endif
 
-       Debug(DPARS, ("load_entry()...about to parse command\n"))
+       Debug(DPARS, ("load_entry()...about to parse command\n"));
 
        /* Everything up to the next \n or EOF is part of the command...
         * too bad we don't know in advance how long it will be, since we
@@ -383,7 +383,7 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
                goto eof;
        }
 
-       Debug(DPARS, ("load_entry()...returning successfully\n"))
+       Debug(DPARS, ("load_entry()...returning successfully\n"));
 
                /* success, fini, return pointer to the entry we just created...
                 */
@@ -415,7 +415,7 @@ get_list(bitstr_t * bits, int low, int high, const char *names[],
         * assume the same thing.
         */
 
-       Debug(DPARS | DEXT, ("get_list()...entered\n"))
+       Debug(DPARS | DEXT, ("get_list()...entered\n"));
 
                /* list = range {"," range}
                 */
@@ -440,7 +440,7 @@ get_list(bitstr_t * bits, int low, int high, const char *names[],
        Skip_Nonblanks(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);
 }
@@ -454,7 +454,7 @@ get_range(bitstr_t * bits, int low, int high, const char *names[],
 
        int i, num1, num2, num3;
 
-       Debug(DPARS | DEXT, ("get_range()...entering, exit won't show\n"))
+       Debug(DPARS | DEXT, ("get_range()...entering, exit won't show\n"));
 
                if (ch == '*') {
                /* '*' means "first-last" but can still be modified by /step
@@ -569,7 +569,7 @@ get_number(int *numptr, int low, const char *names[], int ch, FILE * file,
                if (len != 0 && strchr(terms, ch)) {
                        for (i = 0; names[i] != NULL; i++) {
                                Debug(DPARS | DEXT,
-                                       ("get_num, compare(%s,%s)\n", names[i], temp))
+                                       ("get_num, compare(%s,%s)\n", names[i], temp));
                                        if (!strcasecmp(names[i], temp)) {
                                        *numptr = i + low;
                                        return (ch);
@@ -584,7 +584,7 @@ get_number(int *numptr, int low, const char *names[], int ch, FILE * file,
 }
 
 static int set_element(bitstr_t * bits, int low, int high, int number) {
-       Debug(DPARS | DEXT, ("set_element(?,%d,%d,%d)\n", low, high, number))
+       Debug(DPARS | DEXT, ("set_element(?,%d,%d,%d)\n", low, high, number));
 
                if (number < low || number > high)
                return (EOF);
index 037d7c8dcdc0956eabe6a72eaf408f4a6c4ff3f2..772e9a0bac16eff66e7c9f4b01053a0b479b4453 100644 (file)
--- a/src/env.c
+++ b/src/env.c
@@ -141,7 +141,7 @@ int load_env(char *envstr, FILE * f) {
        if (EOF == get_string(envstr, MAX_ENVSTR, f, "\n"))
                return (ERR);
 
-       Debug(DPARS, ("load_env, read <%s>\n", envstr))
+       Debug(DPARS, ("load_env, read <%s>\n", envstr));
 
                memset(name, 0, sizeof name);
        memset(val, 0, sizeof val);
@@ -212,7 +212,7 @@ int load_env(char *envstr, FILE * f) {
                }
        }
        if (state != FINI && !(state == VALUE && !quotechar)) {
-               Debug(DPARS, ("load_env, not an env var, state = %d\n", state))
+               Debug(DPARS, ("load_env, not an env var, state = %d\n", state));
                        fseek(f, filepos, 0);
                Set_LineNum(fileline);
                return (FALSE);
@@ -232,7 +232,7 @@ int load_env(char *envstr, FILE * f) {
         */
        if (!glue_strings(envstr, MAX_ENVSTR, name, val, '='))
                return (FALSE);
-       Debug(DPARS, ("load_env, <%s> <%s> -> <%s>\n", name, val, envstr))
+       Debug(DPARS, ("load_env, <%s> <%s> -> <%s>\n", name, val, envstr));
                return (TRUE);
 }
 
index fbf40b1970c589b8a5b383d555dfaaeda1c7b689..215753a5f3dd23f5afb5c20d8d9508712bc4b04b 100644 (file)
 #if DEBUGGING
 # define Debug(mask, message) \
                        if ((DebugFlags & (mask)) != 0) \
-                               printf message;
+                               printf message
 #else /* !DEBUGGING */
 # define Debug(mask, message) \
-                       ;
+                       ()
 #endif /* DEBUGGING */
 
 #define        MkUpper(ch)     (islower(ch) ? toupper(ch) : ch)
index 405dd5d231f186767d4e681d0926fb1b2ca215d4..98fd388d765535a397f5f74c02a0f3cf8a230eda 100644 (file)
@@ -112,7 +112,7 @@ int cron_set_job_security_context(entry * e, user * u, char ***jobenv) {
                 * Ensure that these jobs never run in the same minute:
                 */
                minutely_time = time(0);
-               Debug(DSCH, ("Minute-ly job. Recording time %lu\n", minutely_time))
+               Debug(DSCH, ("Minute-ly job. Recording time %lu\n", minutely_time));
        }
 
 #ifdef WITH_PAM
index 6c63c180a6b01c0e9e2f1087436d000e2b2f302d..1fae04e8ccf5bf3e0d054f0bf2cc98adb916104d 100644 (file)
@@ -74,7 +74,7 @@ load_user (int crontab_fd, struct passwd *pw, const char *uname,
                return (NULL);
        }
 
-       Debug(DPARS, ("load_user()\n"))
+       Debug(DPARS, ("load_user()\n"));
        /* file is open.  build user entry, then read the crontab file.
         */
        if ((u = (user *) malloc (sizeof (user))) == NULL)
@@ -140,7 +140,7 @@ done:
        if (envp)
                env_free(envp);
        fclose(file);
-       Debug(DPARS, ("...load_user() done\n"))
+       Debug(DPARS, ("...load_user() done\n"));
        errno = save_errno;
        return (u);
 }