1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

libsystemd-network: fix writing of routes in dhcp lease file

inet_ntoa() uses a static buffer, so you can't call it twice in the
same fprintf() call.
This commit is contained in:
Dan Winship 2014-11-18 08:59:42 -05:00 committed by Tom Gundersen
parent a5ccdb9884
commit fbf7dcb588
Notes: Lennart Poettering 2014-12-09 20:49:42 +01:00
Backport: bugfix

View File

@ -392,10 +392,12 @@ void serialize_dhcp_routes(FILE *f, const char *key, struct sd_dhcp_route *route
fprintf(f, "%s=", key);
for (i = 0; i < size; i++)
fprintf(f, "%s/%" PRIu8 ",%s%s", inet_ntoa(routes[i].dst_addr),
routes[i].dst_prefixlen, inet_ntoa(routes[i].gw_addr),
for (i = 0; i < size; i++) {
fprintf(f, "%s/%" PRIu8, inet_ntoa(routes[i].dst_addr),
routes[i].dst_prefixlen);
fprintf(f, ",%s%s", inet_ntoa(routes[i].gw_addr),
(i < (size - 1)) ? " ": "");
}
fputs("\n", f);
}