]> granicus.if.org Git - cronie/commitdiff
mics: stop using plain integer as NULL pointer
authorSami Kerola <kerolasa@iki.fi>
Sun, 31 Mar 2019 11:52:43 +0000 (12:52 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 13 Apr 2019 05:29:57 +0000 (06:29 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/cron.c
src/crontab.c
src/do_command.c
src/popen.c
src/security.c

index a507bbaff9e10ed6d24d6826792933e85048ab72..7eabfe9369e56183fb2442a93ad248b4511a67b2 100644 (file)
@@ -262,7 +262,7 @@ int main(int argc, char *argv[]) {
         */
        setlocale(LC_ALL, "");  /* set locale to system defaults or to
                                                         * that specified by any  LC_* env vars */
-       if ((cs = nl_langinfo(CODESET)) != 0L)
+       if ((cs = nl_langinfo(CODESET)) != NULL)
                strncpy(cron_default_mail_charset, cs, MAX_ENVSTR-1);
        else
                strcpy(cron_default_mail_charset, "US-ASCII");
index 4e6575124554815d0442aeccffcdf6b165e93019..11d998317164600066e81867ef5fceec81d5edb2 100644 (file)
@@ -419,7 +419,7 @@ static void delete_cmd(void) {
        if (PromptOnDelete == 1) {
                printf("crontab: really delete %s's crontab? ", User);
                fflush(stdout);
-               if ((fgets(n, MAX_FNAME - 1, stdin) == 0L)
+               if ((fgets(n, MAX_FNAME - 1, stdin) == NULL)
                        || ((n[0] != 'Y') && (n[0] != 'y'))
                        )
                        exit(0);
@@ -700,7 +700,7 @@ static void edit_cmd(void) {
                perror("swapping uids back");
                exit(ERROR_EXIT);
        }
-       if (NewCrontab == 0L) {
+       if (NewCrontab == NULL) {
                perror("fopen");
                goto fatal;
        }
@@ -712,7 +712,7 @@ static void edit_cmd(void) {
                        printf("Do you want to retry the same edit? ");
                        fflush(stdout);
                        q[0] = '\0';
-                       if (fgets(q, sizeof q, stdin) == 0L)
+                       if (fgets(q, sizeof q, stdin) == NULL)
                                continue;
                        switch (q[0]) {
                        case 'y':
index aeee1d3c8e4d49bc37500e185f66a4774a048ce1..be38127b9e4f3f41e367e219fe0dea847a64f97f 100644 (file)
@@ -46,7 +46,7 @@ static int safe_p(const char *, const char *);
 void do_command(entry * e, user * u) {
        pid_t pid = getpid();
        int ev;
-       char **jobenv = 0L;
+       char **jobenv = NULL;
 
        Debug(DPROC, ("[%ld] do_command(%s, (%s,%ld,%ld))\n",
                        (long) pid, e->cmd, u->name,
@@ -450,7 +450,7 @@ static int child_process(entry * e, char **jobenv) {
                                fprintf(mail, "Date: %s\n", arpadate(&StartTime));
 #endif /*MAIL_DATE */
                                fprintf(mail, "MIME-Version: 1.0\n");
-                               if (content_type == 0L) {
+                               if (content_type == NULL) {
                                        fprintf(mail, "Content-Type: text/plain; charset=%s\n",
                                                cron_default_mail_charset);
                                }
@@ -461,17 +461,17 @@ static int child_process(entry * e, char **jobenv) {
                                        char *nl = content_type;
                                        size_t ctlen = strlen(content_type);
                                        while ((*nl != '\0')
-                                               && ((nl = strchr(nl, '\n')) != 0L)
+                                               && ((nl = strchr(nl, '\n')) != NULL)
                                                && (nl < (content_type + ctlen))
                                                )
                                                *nl = ' ';
                                        fprintf(mail, "Content-Type: %s\n", content_type);
                                }
-                               if (content_transfer_encoding != 0L) {
+                               if (content_transfer_encoding != NULL) {
                                        char *nl = content_transfer_encoding;
                                        size_t ctlen = strlen(content_transfer_encoding);
                                        while ((*nl != '\0')
-                                               && ((nl = strchr(nl, '\n')) != 0L)
+                                               && ((nl = strchr(nl, '\n')) != NULL)
                                                && (nl < (content_transfer_encoding + ctlen))
                                                )
                                                *nl = ' ';
index eaea20a54bd3b11fe5934d6bec86a49bc9a0d4f9..badddb62ac638bdfccf1642334337ab70f0cfe96 100644 (file)
@@ -168,7 +168,7 @@ int cron_pclose(FILE * iop) {
         * pclose returns -1 if stream is not associated with a
         * `popened' command, or, if already `pclosed'.
         */
-       if (pids == 0 || pids[fdes = fileno(iop)] == 0)
+       if (pids == NULL || pids[fdes = fileno(iop)] == 0L)
                return (-1);
        (void) fclose(iop);
 
index c3207e1d1a0ba0e2b970342bb0259ba9b605d97d..d4d768ed06f5d2dbf682f5ef877c953f359b68ff 100644 (file)
@@ -120,7 +120,7 @@ int cron_set_job_security_context(entry *e, user *u ATTRIBUTE_UNUSED,
                /* "minute-ly" job: Every minute for given hour/dow/month/dom. 
                 * Ensure that these jobs never run in the same minute:
                 */
-               minutely_time = time(0);
+               minutely_time = time(NULL);
                Debug(DSCH, ("Minute-ly job. Recording time %lu\n", minutely_time));
        }
 
@@ -169,7 +169,7 @@ int cron_set_job_security_context(entry *e, user *u ATTRIBUTE_UNUSED,
 
        *jobenv = build_env(e->envp);
 
-       time_t job_run_time = time(0L);
+       time_t job_run_time = time(NULL);
 
        if ((minutely_time > 0) && ((job_run_time / 60) != (minutely_time / 60))) {
                /* if a per-minute job is delayed into the next minute 
@@ -350,12 +350,12 @@ cron_get_job_range(user * u, security_context_t * ucontextp, char **jobenv) {
 
        if (is_selinux_enabled() <= 0)
                return 0;
-       if (ucontextp == 0L)
+       if (ucontextp == NULL)
                return -1;
 
-       *ucontextp = 0L;
+       *ucontextp = NULL;
 
-       if ((range = env_get("MLS_LEVEL", jobenv)) != 0L) {
+       if ((range = env_get("MLS_LEVEL", jobenv)) != NULL) {
                context_t ccon;
                if (!(ccon = context_new(u->scontext))) {
                        log_it(u->name, getpid(), "context_new FAILED for MLS_LEVEL",
@@ -404,7 +404,7 @@ static int cron_change_selinux_range(user * u, security_context_t ucontext) {
        if (is_selinux_enabled() <= 0)
                return 0;
 
-       if (u->scontext == 0L) {
+       if (u->scontext == NULL) {
                if (security_getenforce() > 0) {
                        log_it(u->name, getpid(), "NULL security context for user", "", 0);
                        return -1;
@@ -592,7 +592,7 @@ get_security_context(const char *name, int crontab_fd,
 void free_security_context(security_context_t * scontext) {
        if (*scontext != NULL) {
                freecon(*scontext);
-               *scontext = 0L;
+               *scontext = NULL;
        }
 }
 #endif