shared/bus-message-util: silence gcc warning
[1/429] Compiling C object src/shared/libsystemd-shared-248.a.p/bus-message-util.c.o
../src/shared/bus-message-util.c: In function ‘bus_message_read_dns_servers’:
../src/shared/bus-message-util.c:165:21: warning: ‘family’ may be used uninitialized in this function [-Wmaybe-uninitialized]
165 | r = in_addr_full_new(family, &a, port, 0, server_name, dns + n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/shared/bus-message-util.c:165:21: warning: ‘port’ may be used uninitialized in this function [-Wmaybe-uninitialized]
../src/shared/bus-message-util.c:165:21: warning: ‘server_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]
The warning would be there despite all the asserts in bus_error_setfv() and
sd_bus_error_set(). So let's add an explicit assert.
This commit is contained in:
@@ -98,8 +98,11 @@ static int bus_message_read_dns_one(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!dns_server_address_valid(family, &a))
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid DNS server address");
|
||||
if (!dns_server_address_valid(family, &a)) {
|
||||
r = sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid DNS server address");
|
||||
assert(r < 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
if (extended) {
|
||||
r = sd_bus_message_read(message, "q", &port);
|
||||
|
||||
Reference in New Issue
Block a user