summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/sd-dhcp-lease.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-04 17:01:06 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-06 09:52:52 +0200
commit071e522eec2d4f5f29ef929db4bf40af1860fdac (patch)
tree4915ed22fc9a2be9a99f4ebc9c2595b16724347c /src/libsystemd-network/sd-dhcp-lease.c
parentbasic/in-addr-util: add IN_ADDR_PREFIX_TO_STRING (diff)
downloadsystemd-071e522eec2d4f5f29ef929db4bf40af1860fdac.tar.xz
systemd-071e522eec2d4f5f29ef929db4bf40af1860fdac.zip
tree-wide: convert inet_ntop() calls to anonymous-buffer macros
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-lease.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 8de7c671df..acc57ce53a 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -967,7 +967,6 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
const struct in_addr *addresses;
const void *client_id, *data;
size_t client_id_len, data_len;
- char sbuf[INET_ADDRSTRLEN];
const char *string;
uint16_t mtu;
_cleanup_free_ sd_dhcp_route **routes = NULL;
@@ -989,11 +988,11 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
r = sd_dhcp_lease_get_address(lease, &address);
if (r >= 0)
- fprintf(f, "ADDRESS=%s\n", inet_ntop(AF_INET, &address, sbuf, sizeof(sbuf)));
+ fprintf(f, "ADDRESS=%s\n", IN4_ADDR_TO_STRING(&address));
r = sd_dhcp_lease_get_netmask(lease, &address);
if (r >= 0)
- fprintf(f, "NETMASK=%s\n", inet_ntop(AF_INET, &address, sbuf, sizeof(sbuf)));
+ fprintf(f, "NETMASK=%s\n", IN4_ADDR_TO_STRING(&address));
r = sd_dhcp_lease_get_router(lease, &addresses);
if (r > 0) {
@@ -1004,15 +1003,15 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
r = sd_dhcp_lease_get_server_identifier(lease, &address);
if (r >= 0)
- fprintf(f, "SERVER_ADDRESS=%s\n", inet_ntop(AF_INET, &address, sbuf, sizeof(sbuf)));
+ fprintf(f, "SERVER_ADDRESS=%s\n", IN4_ADDR_TO_STRING(&address));
r = sd_dhcp_lease_get_next_server(lease, &address);
if (r >= 0)
- fprintf(f, "NEXT_SERVER=%s\n", inet_ntop(AF_INET, &address, sbuf, sizeof(sbuf)));
+ fprintf(f, "NEXT_SERVER=%s\n", IN4_ADDR_TO_STRING(&address));
r = sd_dhcp_lease_get_broadcast(lease, &address);
if (r >= 0)
- fprintf(f, "BROADCAST=%s\n", inet_ntop(AF_INET, &address, sbuf, sizeof(sbuf)));
+ fprintf(f, "BROADCAST=%s\n", IN4_ADDR_TO_STRING(&address));
r = sd_dhcp_lease_get_mtu(lease, &mtu);
if (r >= 0)