dhcp: fix systemd-dhcp's writing of routes in lease file
inet_ntoa() uses a static buffer, so you can't call it twice in the same fprintf() call. https://bugs.freedesktop.org/show_bug.cgi?id=86438
This commit is contained in:
@@ -404,10 +404,12 @@ void serialize_dhcp_routes(FILE *f, const char *key, struct sd_dhcp_route *route
|
|||||||
|
|
||||||
fprintf(f, "%s=", key);
|
fprintf(f, "%s=", key);
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++) {
|
||||||
fprintf(f, "%s/%" PRIu8 ",%s%s", inet_ntoa(routes[i].dst_addr),
|
fprintf(f, "%s/%" PRIu8, inet_ntoa(routes[i].dst_addr),
|
||||||
routes[i].dst_prefixlen, inet_ntoa(routes[i].gw_addr),
|
routes[i].dst_prefixlen);
|
||||||
|
fprintf(f, ",%s%s", inet_ntoa(routes[i].gw_addr),
|
||||||
(i < (size - 1)) ? " ": "");
|
(i < (size - 1)) ? " ": "");
|
||||||
|
}
|
||||||
|
|
||||||
fputs("\n", f);
|
fputs("\n", f);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user