[systemd-commits] src/systemctl

Daniel Mack zonque at kemper.freedesktop.org
Fri Feb 21 03:08:48 PST 2014


 src/systemctl/systemctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9e82ffa040448a8f800411c2230ad98ef0e57d9c
Author: Daniel Mack <zonque at gmail.com>
Date:   Fri Feb 21 12:05:38 2014 +0100

    systemctl: fix compiler warning in list_timers()
    
    get_next_elapse() will always fill 'next' with values when it
    returns >= 0. Hence, the compiler is wrong about this warning.
    Initialize 'next' nevertheless.
    
    src/systemctl/systemctl.c: In function ‘list_timers’:
    src/systemctl/systemctl.c:953:43: warning: ‘next.monotonic’ may be used
    uninitialized in this function [-Wmaybe-uninitialized]
                                     converted = nw.realtime - (nw.monotonic - next.monotonic);
                                               ^
    In file included from ./src/shared/log.h:30:0,
                     from src/systemctl/systemctl.c:46:
    ./src/shared/macro.h:137:38: warning: ‘next.realtime’ may be used
    uninitialized in this function [-Wmaybe-uninitialized]
                             _a < _b ? _a : _b;      \
                                          ^
    src/systemctl/systemctl.c:933:32: note: ‘next.realtime’ was declared here
                     dual_timestamp next;
                                    ^

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index a398206..3375bac 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -930,7 +930,7 @@ static int list_timers(sd_bus *bus, char **args) {
 
         for (u = unit_infos; u < unit_infos + n; u++) {
                 _cleanup_strv_free_ char **triggered = NULL;
-                dual_timestamp next;
+                dual_timestamp next = {};
                 usec_t m;
 
                 if (!endswith(u->id, ".timer"))



More information about the systemd-commits mailing list