From 3fbb555e0d8e6c880cea6e426982d3ae6a60c589 Mon Sep 17 00:00:00 2001 From: fengbojiang Date: Mon, 14 Oct 2024 12:03:33 +0800 Subject: [PATCH] Fix kni build error, compatible with both strlcpy and strscpy. --- dpdk/kernel/linux/kni/kni_net.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dpdk/kernel/linux/kni/kni_net.c b/dpdk/kernel/linux/kni/kni_net.c index 1d0375100..f6504db6a 100644 --- a/dpdk/kernel/linux/kni/kni_net.c +++ b/dpdk/kernel/linux/kni/kni_net.c @@ -806,8 +806,13 @@ static const struct net_device_ops kni_net_netdev_ops = { static void kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { +#if __GNUC__ >= 13 strscpy(info->version, KNI_VERSION, sizeof(info->version)); strscpy(info->driver, "kni", sizeof(info->driver)); +#else + strlcpy(info->version, KNI_VERSION, sizeof(info->version)); + strlcpy(info->driver, "kni", sizeof(info->driver)); +#endif } static const struct ethtool_ops kni_net_ethtool_ops = {