1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

Fix maybe-uninitialized warnings with gcc 14.2

../src/resolve/resolved-bus.c: In function ‘call_link_method’:
../src/resolve/resolved-bus.c:1769:16: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
 1769 |         return handler(message, l, error);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
../src/resolve/resolved-bus.c:1755:15: note: ‘l’ was declared here
 1755 |         Link *l;
      |               ^
../src/resolve/resolved-bus.c: In function ‘bus_method_get_link’:
../src/resolve/resolved-bus.c:1828:13: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
 1828 |         p = link_bus_path(l);
      |             ^~~~~~~~~~~~~~~~
../src/resolve/resolved-bus.c:1816:15: note: ‘l’ was declared here
 1816 |         Link *l;
      |               ^
This commit is contained in:
Luca Boccassi 2024-10-16 11:42:06 +01:00 committed by Lennart Poettering
parent cc2030f928
commit 5f911aca84

View File

@ -1752,7 +1752,7 @@ static int get_any_link(Manager *m, int ifindex, Link **ret, sd_bus_error *error
static int call_link_method(Manager *m, sd_bus_message *message, sd_bus_message_handler_t handler, sd_bus_error *error) {
int ifindex, r;
Link *l;
Link *l = NULL; /* avoid false maybe-uninitialized warning */
assert(m);
assert(message);
@ -1813,7 +1813,7 @@ static int bus_method_get_link(sd_bus_message *message, void *userdata, sd_bus_e
_cleanup_free_ char *p = NULL;
Manager *m = ASSERT_PTR(userdata);
int r, ifindex;
Link *l;
Link *l = NULL; /* avoid false maybe-uninitialized warning */
assert(message);