[OE-core] [PATCH 1/2] systemd: Fix build with gcc9

Adrian Bunk bunk at stusta.de
Mon May 6 18:23:39 UTC 2019


On Mon, May 06, 2019 at 10:51:35AM -0700, Khem Raj wrote:
>...
> +gcc-9 has become a bit stricter and can check all kind of formatted
> +input/output functions which causes additional warnings when compiling
> +networkd
> +
> +/src/basic/log.h:104:9: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
> +         log_internal_realm(LOG_REALM_PLUS_LEVEL(LOG_REALM, (level)), __VA_ARGS__)
>...
> +         if (r < 0)
> +                 log_link_warning_errno(link, r, "Cannot %s IPv6 for interface %s: %m",
> +-                                       enable_disable(!disabled), link->ifname);
> ++                                       enable_disable(!disabled),
> ++                                       (link->ifname) ? link->ifname : "<null>");
>...

The fix doesn't look correct to me:
gcc says it "is null", so checking whether or not it is null doesn't
match the error message.

If it is a compiler bug as was at some point mentioned upstream,
a better temporary workaround would be to stop making this an error
with -Wno-error=format-overflow (untested).

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



More information about the Openembedded-core mailing list