From 6588c9822fca247c94ec16f659baecf723c55b24 Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Thu, 4 Aug 2022 21:40:18 +0800 Subject: [PATCH] fast_ping: supress error log --- src/fast_ping.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/fast_ping.c b/src/fast_ping.c index c87b094..55649aa 100644 --- a/src/fast_ping.c +++ b/src/fast_ping.c @@ -673,6 +673,12 @@ static int _fast_ping_create_icmp_sock(FAST_PING_TYPE type) } } if (fd < 0) { + if (errno == EACCES || errno == EAFNOSUPPORT) { + if (bool_print_log == 0) { + goto errout; + } + bool_print_log = 0; + } tlog(TLOG_ERROR, "create icmp socket failed, %s\n", strerror(errno)); goto errout; } @@ -689,6 +695,12 @@ static int _fast_ping_create_icmp_sock(FAST_PING_TYPE type) } if (fd < 0) { + if (errno == EACCES || errno == EAFNOSUPPORT) { + if (bool_print_log == 0) { + goto errout; + } + bool_print_log = 0; + } tlog(TLOG_ERROR, "create icmp socket failed, %s\n", strerror(errno)); goto errout; }