mirror of https://github.com/F-Stack/f-stack.git
Fix ff tools error, compatible with -Wstringop-overflow with different gcc versions.
This commit is contained in:
parent
50188e997c
commit
8a66430fa8
|
@ -832,8 +832,13 @@ static const struct net_device_ops kni_net_netdev_ops = {
|
||||||
static void kni_get_drvinfo(struct net_device *dev,
|
static void kni_get_drvinfo(struct net_device *dev,
|
||||||
struct ethtool_drvinfo *info)
|
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->version, KNI_VERSION, sizeof(info->version));
|
||||||
strlcpy(info->driver, "kni", sizeof(info->driver));
|
strlcpy(info->driver, "kni", sizeof(info->driver));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct ethtool_ops kni_net_ethtool_ops = {
|
static const struct ethtool_ops kni_net_ethtool_ops = {
|
||||||
|
|
|
@ -233,10 +233,14 @@ NgDeliverMsg(int cs, const char *path,
|
||||||
/* Prepare socket address */
|
/* Prepare socket address */
|
||||||
sg->sg_family = AF_NETGRAPH;
|
sg->sg_family = AF_NETGRAPH;
|
||||||
/* XXX handle overflow */
|
/* XXX handle overflow */
|
||||||
|
#if __GNUC__ >= 13
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||||
|
#endif
|
||||||
strncpy(sg->sg_data, path, NG_PATHSIZ);
|
strncpy(sg->sg_data, path, NG_PATHSIZ);
|
||||||
|
#if __GNUC__ >= 13
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
sg->sg_len = strlen(sg->sg_data) + 1 + NGSA_OVERHEAD;
|
sg->sg_len = strlen(sg->sg_data) + 1 + NGSA_OVERHEAD;
|
||||||
|
|
||||||
/* Debugging */
|
/* Debugging */
|
||||||
|
|
|
@ -108,10 +108,14 @@ WriteCmd(int ac, char **av)
|
||||||
/* Send data */
|
/* Send data */
|
||||||
sag->sg_len = 3 + strlen(hook);
|
sag->sg_len = 3 + strlen(hook);
|
||||||
sag->sg_family = AF_NETGRAPH;
|
sag->sg_family = AF_NETGRAPH;
|
||||||
|
#if __GNUC__ >= 13
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||||
|
#endif
|
||||||
strlcpy(sag->sg_data, hook, sizeof(sagbuf) - 2);
|
strlcpy(sag->sg_data, hook, sizeof(sagbuf) - 2);
|
||||||
|
#if __GNUC__ >= 13
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
if (sendto(dsock, buf, len,
|
if (sendto(dsock, buf, len,
|
||||||
0, (struct sockaddr *)sag, sag->sg_len) == -1) {
|
0, (struct sockaddr *)sag, sag->sg_len) == -1) {
|
||||||
warn("writing to hook \"%s\"", hook);
|
warn("writing to hook \"%s\"", hook);
|
||||||
|
|
Loading…
Reference in New Issue