]> granicus.if.org Git - cronie/commitdiff
cronnext: Fix warnings
authorTomas Mraz <tmraz@fedoraproject.org>
Mon, 27 Jun 2016 12:51:10 +0000 (14:51 +0200)
committerTomas Mraz <tmraz@fedoraproject.org>
Mon, 27 Jun 2016 12:51:10 +0000 (14:51 +0200)
src/cronnext.c

index 2638c1412149867a18ef08cbd752cd95d2a1b929..0e8144e93d9702f40fe994187beda314c0a67e69 100644 (file)
@@ -62,7 +62,7 @@ void printentry(entry *e, int system, time_t next) {
        printf("cmd: %s\n", e->cmd);
        printflags(e->flags);
        printf("delay: %d\n", e->delay);
-       printf("next: %d = ", next);
+       printf("next: %ld = ", (long)next);
        printf("%s", asctime(localtime(&next)));
 }
 
@@ -94,7 +94,6 @@ void printcrontab(user *u) {
  */
 int matchday(entry *e, time_t time) {
        struct tm current;
-       int d;
 
        localtime_r(&time, &current);
 
@@ -111,9 +110,7 @@ int matchday(entry *e, time_t time) {
  */
 time_t nextmatch(entry *e, time_t start) {
        time_t time;
-       time_t nexttime;
        struct tm current;
-       int res;
 
        /* maximum match interval is 8 years (<102 months of 28 days):
         * crontab has '* * 29 2 *' and we are on 1 March 2096:
@@ -167,7 +164,7 @@ int matchuser(char *user, char *list) {
        char *pos;
        int l = strlen(user);
 
-       for (pos = list; pos = strstr(pos, user); pos += l) {
+       for (pos = list; (pos = strstr(pos, user)) != NULL; pos += l) {
                if ((pos != list) && (*(pos - 1) != ','))
                        continue;
                if ((pos[l] != '\0') && (pos[l] != ','))
@@ -290,10 +287,10 @@ int main(int argn, char *argv[]) {
        }
        else
                if (verbose)
-                       printf("next of all jobs: %d = %s",
-                               next, asctime(localtime(&next)));
+                       printf("next of all jobs: %ld = %s",
+                               (long)next, asctime(localtime(&next)));
                else
-                       printf("%d\n", next);
+                       printf("%ld\n", (long)next);
 
        return EXIT_SUCCESS;
 }