1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-20 14:03:39 +03:00

libsystemd-network: inet_pton does not set errno on parsing error

it would set errno only for an invalid address family.

Also fix a copy&paste error in one error string.
This commit is contained in:
Michal Schmidt 2015-11-05 13:44:10 +01:00
parent 5cfab271fe
commit e26ea7fc2d

View File

@ -951,19 +951,19 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
if (address) {
r = inet_pton(AF_INET, address, &lease->address);
if (r <= 0)
log_debug_errno(errno, "Failed to parse address %s, ignoring: %m", address);
log_debug("Failed to parse address %s, ignoring.", address);
}
if (router) {
r = inet_pton(AF_INET, router, &lease->router);
if (r <= 0)
log_debug_errno(errno, "Failed to parse router %s, ignoring: %m", router);
log_debug("Failed to parse router %s, ignoring.", router);
}
if (netmask) {
r = inet_pton(AF_INET, netmask, &lease->subnet_mask);
if (r <= 0)
log_debug_errno(errno, "Failed to parse netmask %s, ignoring: %m", netmask);
log_debug("Failed to parse netmask %s, ignoring.", netmask);
else
lease->have_subnet_mask = true;
}
@ -971,19 +971,19 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
if (server_address) {
r = inet_pton(AF_INET, server_address, &lease->server_address);
if (r <= 0)
log_debug_errno(errno, "Failed to parse netmask %s, ignoring: %m", server_address);
log_debug("Failed to parse server address %s, ignoring.", server_address);
}
if (next_server) {
r = inet_pton(AF_INET, next_server, &lease->next_server);
if (r <= 0)
log_debug_errno(errno, "Failed to parse next server %s, ignoring: %m", next_server);
log_debug("Failed to parse next server %s, ignoring.", next_server);
}
if (broadcast) {
r = inet_pton(AF_INET, broadcast, &lease->broadcast);
if (r <= 0)
log_debug_errno(errno, "Failed to parse broadcast address %s, ignoring: %m", broadcast);
log_debug("Failed to parse broadcast address %s, ignoring.", broadcast);
else
lease->have_broadcast = true;
}