1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-07 17:17:44 +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;
      |               ^

(cherry picked from commit 5f911aca8434b4163514019fcb4c1c967a50617c)
(cherry picked from commit 2590b77f39f7c1264b686e0b379465f5670631d3)
This commit is contained in:
Luca Boccassi 2024-10-16 11:42:06 +01:00
parent 6b13398c22
commit 4c9509ad0c

View File

@ -1739,7 +1739,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);
@ -1800,7 +1800,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);