]> git.proxmox.com Git - mirror_frr.git/commitdiff
*: fix some dumb printf format warnings
authorDavid Lamparter <equinox@diac24.net>
Thu, 6 Jun 2019 21:48:15 +0000 (23:48 +0200)
committerDavid Lamparter <equinox@diac24.net>
Tue, 11 Jun 2019 11:34:57 +0000 (13:34 +0200)
Some types like `time_t` vary across platforms and always need to be
cast when printed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/thread.c
sharpd/sharp_vty.c
sharpd/sharp_zebra.c
watchfrr/watchfrr.c

index 3879e936a14c074e15bb63cb161938fe3dde7827..7489be5c2dad0aebb0b8de4833ac614de64654cd 100644 (file)
@@ -96,8 +96,10 @@ static void vty_out_cpu_thread_history(struct vty *vty,
                                       struct cpu_thread_history *a)
 {
        vty_out(vty, "%5zu %10zu.%03zu %9zu %8zu %9zu %8zu %9zu",
-               a->total_active, a->cpu.total / 1000, a->cpu.total % 1000,
-               a->total_calls, a->cpu.total / a->total_calls, a->cpu.max,
+               (size_t)a->total_active,
+               a->cpu.total / 1000, a->cpu.total % 1000,
+               (size_t)a->total_calls,
+               a->cpu.total / a->total_calls, a->cpu.max,
                a->real.total / a->total_calls, a->real.max);
        vty_out(vty, " %c%c%c%c%c %s\n",
                a->types & (1 << THREAD_READ) ? 'R' : ' ',
index dad09dd99217b84fa36609095a2e56906e77420c..a7552547e968362ec2f62ced0a4241427a43f4dc 100644 (file)
@@ -145,12 +145,12 @@ DEFPY (install_routes_data_dump,
        struct timeval r;
 
        timersub(&sg.r.t_end, &sg.r.t_start, &r);
-       vty_out(vty, "Prefix: %s Total: %u %u %u Time: %ld.%ld\n",
+       vty_out(vty, "Prefix: %s Total: %u %u %u Time: %jd.%ld\n",
                prefix2str(&sg.r.orig_prefix, buf, sizeof(buf)),
                sg.r.total_routes,
                sg.r.installed_routes,
                sg.r.removed_routes,
-               r.tv_sec, (long int)r.tv_usec);
+               (intmax_t)r.tv_sec, (long)r.tv_usec);
 
        return CMD_SUCCESS;
 }
index 744707699343323cf15e23a0ed1e4db473c4c098..cd6f9565802dca1f2e19fcdafbc4c99e90ffebd1 100644 (file)
@@ -212,8 +212,8 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
                if (sg.r.total_routes == sg.r.installed_routes) {
                        monotime(&sg.r.t_end);
                        timersub(&sg.r.t_end, &sg.r.t_start, &r);
-                       zlog_debug("Installed All Items %ld.%ld", r.tv_sec,
-                                  (long int)r.tv_usec);
+                       zlog_debug("Installed All Items %jd.%ld",
+                                  (intmax_t)r.tv_sec, (long)r.tv_usec);
                        handle_repeated(true);
                }
                break;
@@ -228,8 +228,8 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS)
                if (sg.r.total_routes == sg.r.removed_routes) {
                        monotime(&sg.r.t_end);
                        timersub(&sg.r.t_end, &sg.r.t_start, &r);
-                       zlog_debug("Removed all Items %ld.%ld", r.tv_sec,
-                                  (long int)r.tv_usec);
+                       zlog_debug("Removed all Items %jd.%ld",
+                                  (intmax_t)r.tv_sec, (long)r.tv_usec);
                        handle_repeated(false);
                }
                break;
index 1cc7722f4f7170bb8d89dbf4f2159f46c5f07fea..c17d3817301339376f4c0d67cf18e7aed601f486 100644 (file)
@@ -1021,10 +1021,11 @@ void watchfrr_status(struct vty *vty)
                else if (dmn->state == DAEMON_DOWN &&
                        time_elapsed(&delay, &dmn->restart.time)->tv_sec
                                < dmn->restart.interval)
-                       vty_out(vty, "      restarting in %ld seconds"
-                               " (%lds backoff interval)\n",
-                               dmn->restart.interval - delay.tv_sec,
-                               dmn->restart.interval);
+                       vty_out(vty, "      restarting in %jd seconds"
+                               " (%jds backoff interval)\n",
+                               (intmax_t)dmn->restart.interval
+                                       - (intmax_t)delay.tv_sec,
+                               (intmax_t)dmn->restart.interval);
        }
 }