diff options
author | Jonas Gorski <jonas.gorski@bisdn.de> | 2022-06-24 12:27:40 (GMT) |
---|---|---|
committer | Jonas Gorski <jonas.gorski@bisdn.de> | 2022-07-06 15:34:09 (GMT) |
commit | 25d42a4f3c7daa5e14f174a31f14c4e1f2289e46 (patch) | |
tree | 8a8e0c8a6ebc894fcb770e53d04488b0d311b872 /lib | |
parent | 0c0aee829c1d2d468d89eda75d38e7490e4de575 (diff) | |
download | libnl-25d42a4f3c7daa5e14f174a31f14c4e1f2289e46.zip libnl-25d42a4f3c7daa5e14f174a31f14c4e1f2289e46.tar.gz libnl-25d42a4f3c7daa5e14f174a31f14c4e1f2289e46.tar.bz2 |
addr: allow constructing all-zero addresses
Allow easy contruction of all-zero addresses by not passing a buf to
copy. Since the object is allocated with calloc, the address data will
default to all-zero, and only the length needs to be set.
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/addr.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -226,7 +226,7 @@ struct nl_addr *nl_addr_build(int family, const void *buf, size_t size) addr->a_prefixlen = size*8; } - if (size) + if (size && buf) memcpy(addr->a_addr, buf, size); return addr; |