summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-lease.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-12-13 08:41:11 +0100
committerThomas Haller <thaller@redhat.com>2017-12-13 11:12:19 +0100
commitdbcb4a900ef7e9673604caabc1e1842309b7fd73 (patch)
tree60ef21f2f084efa72e0284b0efdc433193158f96 /src/libsystemd-network/sd-dhcp-lease.c
parent6febe75da76517a69f073fb50abffc5c2c7d58cd (diff)
downloadsystemd-dbcb4a900ef7e9673604caabc1e1842309b7fd73.tar.gz
tree-wide: use STRLEN() to allocate buffer of constant size
Using strlen() to declare a buffer results in a variable-length array, even if the compiler likely optimizes it to be a compile time constant. When building with -Wvla, certain versions of gcc complain about such buffers. Compiling with -Wvla has the advantage of preventing variably length array, which defeat static asserts that are implemented by declaring an array of negative length.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-lease.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 7063bd986e..a186bca38f 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -987,7 +987,7 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
}
LIST_FOREACH(options, option, lease->private_options) {
- char key[strlen("OPTION_000")+1];
+ char key[STRLEN("OPTION_000")+1];
xsprintf(key, "OPTION_%" PRIu8, option->tag);
r = serialize_dhcp_option(f, key, option->data, option->length);