summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/dhcp-identifier.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-01-10 16:13:06 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-01-16 13:34:31 +0100
commit29cf0ff82386587e010ae2d417ff903da7537494 (patch)
tree08337d34ed76a2754332cb449bda63d4fb0bccd7 /src/libsystemd-network/dhcp-identifier.c
parentudev: 'val' may be NULL, use strempty() (diff)
downloadsystemd-29cf0ff82386587e010ae2d417ff903da7537494.tar.xz
systemd-29cf0ff82386587e010ae2d417ff903da7537494.zip
libsystemd-network: use xsprintf in one more place
DECIMAL_STR_MAX includes space for NUL, so we don't need 2 here.
Diffstat (limited to 'src/libsystemd-network/dhcp-identifier.c')
-rw-r--r--src/libsystemd-network/dhcp-identifier.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c
index 07496adaa3..4221b9c504 100644
--- a/src/libsystemd-network/dhcp-identifier.c
+++ b/src/libsystemd-network/dhcp-identifier.c
@@ -11,6 +11,7 @@
#include "network-internal.h"
#include "siphash24.h"
#include "sparse-endian.h"
+#include "stdio-util.h"
#include "virt.h"
#define SYSTEMD_PEN 43793
@@ -169,10 +170,10 @@ int dhcp_identifier_set_iaid(
if (detect_container() <= 0) {
/* not in a container, udev will be around */
- char ifindex_str[2 + DECIMAL_STR_MAX(int)];
+ char ifindex_str[1 + DECIMAL_STR_MAX(int)];
int r;
- sprintf(ifindex_str, "n%d", ifindex);
+ xsprintf(ifindex_str, "n%d", ifindex);
if (sd_device_new_from_device_id(&device, ifindex_str) >= 0) {
r = sd_device_get_is_initialized(device);
if (r < 0)