chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a5ccdb9
)
libsystemd-network: fix writing of routes in dhcp lease file
author
Dan Winship
<danw@redhat.com>
Tue, 18 Nov 2014 13:59:42 +0000
(08:59 -0500)
committer
Tom Gundersen
<teg@jklm.no>
Tue, 9 Dec 2014 08:38:13 +0000
(09:38 +0100)
inet_ntoa() uses a static buffer, so you can't call it twice in the
same fprintf() call.
src/libsystemd-network/network-internal.c
patch
|
blob
|
history
diff --git
a/src/libsystemd-network/network-internal.c
b/src/libsystemd-network/network-internal.c
index 90f830a3517c542e76e290d308e514c0b5a37a79..6852a7129a865dad1b7444d7f56a4d07852efaa7 100644
(file)
--- a/
src/libsystemd-network/network-internal.c
+++ b/
src/libsystemd-network/network-internal.c
@@
-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);
}