Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/cron WARNS=6



details:   https://anonhg.NetBSD.org/src/rev/b196ecf0d981
branches:  trunk
changeset: 332070:b196ecf0d981
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Sep 05 21:32:37 2014 +0000

description:
WARNS=6

diffstat:

 external/bsd/cron/bin/Makefile.inc  |   6 ++--
 external/bsd/cron/dist/cron.c       |  22 +++++++++---------
 external/bsd/cron/dist/crontab.c    |  10 ++++----
 external/bsd/cron/dist/do_command.c |   6 ++--
 external/bsd/cron/dist/entry.c      |  10 ++++----
 external/bsd/cron/dist/env.c        |  43 ++++++++++++++++++------------------
 external/bsd/cron/dist/popen.c      |   8 +++---
 7 files changed, 53 insertions(+), 52 deletions(-)

diffs (truncated from 336 to 300 lines):

diff -r 8d17d525b2e3 -r b196ecf0d981 external/bsd/cron/bin/Makefile.inc
--- a/external/bsd/cron/bin/Makefile.inc        Fri Sep 05 21:22:35 2014 +0000
+++ b/external/bsd/cron/bin/Makefile.inc        Fri Sep 05 21:32:37 2014 +0000
@@ -1,5 +1,5 @@
-#      $NetBSD: Makefile.inc,v 1.2 2011/09/16 16:41:20 joerg Exp $
+#      $NetBSD: Makefile.inc,v 1.3 2014/09/05 21:32:37 christos Exp $
 
 .PATH: ${.PARSEDIR}/../dist
-WARNS?=                4
-CWARNFLAGS+=   -Wno-missing-noreturn
+WARNS?=                6
+#CPPFLAGS+=    -DDEBUGGING
diff -r 8d17d525b2e3 -r b196ecf0d981 external/bsd/cron/dist/cron.c
--- a/external/bsd/cron/dist/cron.c     Fri Sep 05 21:22:35 2014 +0000
+++ b/external/bsd/cron/dist/cron.c     Fri Sep 05 21:32:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cron.c,v 1.7 2010/10/02 12:22:20 tron Exp $    */
+/*     $NetBSD: cron.c,v 1.8 2014/09/05 21:32:37 christos Exp $        */
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: cron.c,v 1.12 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: cron.c,v 1.7 2010/10/02 12:22:20 tron Exp $");
+__RCSID("$NetBSD: cron.c,v 1.8 2014/09/05 21:32:37 christos Exp $");
 #endif
 #endif
 
@@ -39,7 +39,7 @@
                run_reboot_jobs(cron_db *),
                find_jobs(time_t, cron_db *, int, int),
                set_time(int),
-               cron_sleep(int),
+               cron_sleep(time_t),
                sigchld_handler(int),
                sighup_handler(int),
                sigchld_reaper(void),
@@ -131,7 +131,7 @@
         * clockTime: is the time when set_time was last called.
         */
        for (;;) {
-               int timeDiff;
+               time_t timeDiff;
                enum timejump wakeupKind;
 
                /* ... wait for the time (in minutes) to change ... */
@@ -169,8 +169,8 @@
                                 * (wokeup late) run jobs for each virtual
                                 * minute until caught up.
                                 */
-                               Debug(DSCH, ("[%ld], normal case %d minutes to go\n",
-                                   (long)getpid(), timeDiff));
+                               Debug(DSCH, ("[%jd], normal case %jd minutes to go\n",
+                                   (intmax_t)getpid(), (intmax_t)timeDiff));
                                do {
                                        if (job_runqueue())
                                                (void)sleep(10);
@@ -192,8 +192,8 @@
                                 * have a chance to run, and we do our
                                 * housekeeping.
                                 */
-                               Debug(DSCH, ("[%ld], DST begins %d minutes to go\n",
-                                   (long)getpid(), timeDiff));
+                               Debug(DSCH, ("[%jd], DST begins %jd minutes to go\n",
+                                   (intmax_t)getpid(), (intmax_t)timeDiff));
                                /* run wildcard jobs for current minute */
                                find_jobs(timeRunning, &database, TRUE, FALSE);
        
@@ -218,8 +218,8 @@
                                 * not be repeated.  Virtual time does not
                                 * change until we are caught up.
                                 */
-                               Debug(DSCH, ("[%ld], DST ends %d minutes to go\n",
-                                   (long)getpid(), timeDiff));
+                               Debug(DSCH, ("[%jd], DST ends %jd minutes to go\n",
+                                   (intmax_t)getpid(), (intmax_t)timeDiff));
                                find_jobs(timeRunning, &database, TRUE, FALSE);
                                break;
                        default:
@@ -458,7 +458,7 @@
  * Try to just hit the next minute.
  */
 static void
-cron_sleep(int target) {
+cron_sleep(time_t target) {
        time_t t1, t2;
        int seconds_to_wait;
 
diff -r 8d17d525b2e3 -r b196ecf0d981 external/bsd/cron/dist/crontab.c
--- a/external/bsd/cron/dist/crontab.c  Fri Sep 05 21:22:35 2014 +0000
+++ b/external/bsd/cron/dist/crontab.c  Fri Sep 05 21:32:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crontab.c,v 1.8 2014/09/05 20:55:11 christos Exp $     */
+/*     $NetBSD: crontab.c,v 1.9 2014/09/05 21:32:37 christos Exp $     */
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: crontab.c,v 1.8 2014/09/05 20:55:11 christos Exp $");
+__RCSID("$NetBSD: crontab.c,v 1.9 2014/09/05 21:32:37 christos Exp $");
 #endif
 #endif
 
@@ -613,7 +613,7 @@
            if (fgets(n2, (int)sizeof(n2), fmaxtabsize) == NULL)  {
                maxtabsize = 0;
            } else {
-               maxtabsize = atoi(n2);
+               maxtabsize = (size_t)atoi(n2);
            }
            (void)fclose(fmaxtabsize);
        } else {
@@ -638,7 +638,7 @@
         */
        (void)fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n");
        (void)fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now));
-       (void)fprintf(tmp, "# (Cron version %s -- %s)\n", CRON_VERSION, "$NetBSD: crontab.c,v 1.8 2014/09/05 20:55:11 christos Exp $");
+       (void)fprintf(tmp, "# (Cron version %s -- %s)\n", CRON_VERSION, "$NetBSD: crontab.c,v 1.9 2014/09/05 21:32:37 christos Exp $");
 
        /* copy the crontab to the tmp
         */
@@ -646,7 +646,7 @@
        Set_LineNum(1);
        lastch = EOF;
        while (EOF != (ch = get_char(NewCrontab)))
-               (void)putc(lastch = ch, tmp);
+               (void)putc(lastch = (char)ch, tmp);
 
        if (lastch != (char)EOF && lastch != '\n') {
                warnx("missing trailing newline in `%s'", Filename);
diff -r 8d17d525b2e3 -r b196ecf0d981 external/bsd/cron/dist/do_command.c
--- a/external/bsd/cron/dist/do_command.c       Fri Sep 05 21:22:35 2014 +0000
+++ b/external/bsd/cron/dist/do_command.c       Fri Sep 05 21:32:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: do_command.c,v 1.5 2014/06/23 01:00:48 christos Exp $  */
+/*     $NetBSD: do_command.c,v 1.6 2014/09/05 21:32:37 christos Exp $  */
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: do_command.c,v 1.9 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: do_command.c,v 1.5 2014/06/23 01:00:48 christos Exp $");
+__RCSID("$NetBSD: do_command.c,v 1.6 2014/09/05 21:32:37 christos Exp $");
 #endif
 #endif
 
@@ -128,7 +128,7 @@
                        }
 
                        if (!(escaped = (ch == '\\'))) {
-                               *p++ = ch;
+                               *p++ = (char)ch;
                        }
                }
                if (ch == '\0') {
diff -r 8d17d525b2e3 -r b196ecf0d981 external/bsd/cron/dist/entry.c
--- a/external/bsd/cron/dist/entry.c    Fri Sep 05 21:22:35 2014 +0000
+++ b/external/bsd/cron/dist/entry.c    Fri Sep 05 21:32:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: entry.c,v 1.5 2014/06/24 09:17:54 skrll Exp $  */
+/*     $NetBSD: entry.c,v 1.6 2014/09/05 21:32:37 christos Exp $       */
 
 /*
  * Copyright 1988,1990,1993,1994 by Paul Vixie
@@ -26,7 +26,7 @@
 #if 0
 static char rcsid[] = "Id: entry.c,v 1.17 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: entry.c,v 1.5 2014/06/24 09:17:54 skrll Exp $");
+__RCSID("$NetBSD: entry.c,v 1.6 2014/09/05 21:32:37 christos Exp $");
 #endif
 #endif
 
@@ -453,7 +453,7 @@
        if (low >= high)
                return low;
        else
-               return arc4random() % (high - low + 1) + low;
+               return (int)arc4random() % (high - low + 1) + low;
 }
 
 static int
@@ -588,7 +588,7 @@
        while (isdigit((unsigned char)ch)) {
                if (++len >= MAX_TEMPSTR)
                        goto bad;
-               *pc++ = ch;
+               *pc++ = (char)ch;
                ch = get_char(file);
        }
        *pc = '\0';
@@ -605,7 +605,7 @@
                while (isalpha((unsigned char)ch)) {
                        if (++len >= MAX_TEMPSTR)
                                goto bad;
-                       *pc++ = ch;
+                       *pc++ = (char)ch;
                        ch = get_char(file);
                }
                *pc = '\0';
diff -r 8d17d525b2e3 -r b196ecf0d981 external/bsd/cron/dist/env.c
--- a/external/bsd/cron/dist/env.c      Fri Sep 05 21:22:35 2014 +0000
+++ b/external/bsd/cron/dist/env.c      Fri Sep 05 21:32:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: env.c,v 1.2 2010/05/06 18:53:17 christos Exp $ */
+/*     $NetBSD: env.c,v 1.3 2014/09/05 21:32:37 christos Exp $ */
 
 /* Copyright 1988,1990,1993,1994 by Paul Vixie
  * All rights reserved
@@ -25,7 +25,7 @@
 #if 0
 static char rcsid[] = "Id: env.c,v 1.10 2004/01/23 18:56:42 vixie Exp";
 #else
-__RCSID("$NetBSD: env.c,v 1.2 2010/05/06 18:53:17 christos Exp $");
+__RCSID("$NetBSD: env.c,v 1.3 2014/09/05 21:32:37 christos Exp $");
 #endif
 #endif
 
@@ -51,44 +51,45 @@
 
 char **
 env_copy(char **envp) {
-       int count, i, save_errno;
+       size_t count, i;
+       int save_errno;
        char **p;
 
        for (count = 0; envp[count] != NULL; count++)
                continue;
-       p = malloc((count+1) * sizeof(*p));  /* 1 for the NULL */
-       if (p != NULL) {
-               for (i = 0; i < count; i++)
-                       if ((p[i] = strdup(envp[i])) == NULL) {
-                               save_errno = errno;
-                               while (--i >= 0)
-                                       free(p[i]);
-                               free(p);
-                               errno = save_errno;
-                               return (NULL);
-                       }
-               p[count] = NULL;
-       }
-       return (p);
+       p = malloc((count + 1) * sizeof(*p));  /* 1 for the NULL */
+       if (p != NULL)
+           return NULL;
+       for (i = 0; i < count; i++)
+               if ((p[i] = strdup(envp[i])) == NULL) {
+                       save_errno = errno;
+                       for (count = 0; count < i; count++)
+                               free(p[count]);
+                       free(p);
+                       errno = save_errno;
+                       return NULL;
+               }
+       p[count] = NULL;
+       return p;
 }
 
 char **
 env_set(char **envp, char *envstr) {
-       int count, found;
+       size_t count, found;
        char **p, *envtmp;
 
        /*
         * count the number of elements, including the null pointer;
         * also set 'found' to -1 or index of entry if already in here.
         */
-       found = -1;
+       found = (size_t)-1;
        for (count = 0; envp[count] != NULL; count++) {
                if (!strcmp_until(envp[count], envstr, '='))
                        found = count;
        }
        count++;        /* for the NULL */
 
-       if (found != -1) {
+       if (found != (size_t)-1) {
                /*
                 * it exists already, so just free the existing setting,
                 * save our new one there, and return the existing array.
@@ -107,7 +108,7 @@
         */
        if ((envtmp = strdup(envstr)) == NULL)
                return (NULL);
-       p = realloc(envp, (size_t) ((count+1) * sizeof(*p)));
+       p = realloc(envp, (count + 1) * sizeof(*p));
        if (p == NULL) {
                free(envtmp);
                return (NULL);
diff -r 8d17d525b2e3 -r b196ecf0d981 external/bsd/cron/dist/popen.c
--- a/external/bsd/cron/dist/popen.c    Fri Sep 05 21:22:35 2014 +0000



Home | Main Index | Thread Index | Old Index