commit 0c147b1adcd3984bae29c89a7fb8f207c20b8b0f
parent 3500ed792e0d266d9ef55bba52287746725be65e
Author: mrbesen <y.g.2@gmx.de>
Date: Sun, 11 Sep 2022 19:43:46 +0200
change error reporting on failed pings
Diffstat:
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/cnping.c b/cnping.c
@@ -804,14 +804,7 @@ int main( int argc, const char ** argv )
CNFGPenX = 100; CNFGPenY = 100;
CNFGColor( 0xff0000ff );
- if( ping_failed_to_send )
- {
- CNFGDrawText( "Could not send ping.\nIs target reachable?\nDo you have sock_raw to privileges?", 3 );
- }
- else
- {
- CNFGDrawText( errbuffer, 3 );
- }
+ CNFGDrawText( errbuffer, 3 );
frames++;
diff --git a/ping.c b/ping.c
@@ -284,10 +284,7 @@ int isICMPResponse(unsigned char* buf, int bytes)
}
else if( psaddr.sin6_family == AF_INET6 ) // ipv6 compare
{
- if( buf[0] != ICMP6_ECHO_REPLY ) {
- printf("buf[0] failed\n");
- return 0;
- }
+ if( buf[0] != ICMP6_ECHO_REPLY ) return 0;
}
return 1;
@@ -410,7 +407,7 @@ void ping(struct sockaddr *addr, socklen_t addr_len )
if( sr <= 0 )
{
ping_failed_to_send = 1;
- ERRM("Ping send failed: %s errno: %d\n", strerror(errno), errno);
+ ERRMB("Ping send failed:\n%s (%d)\n", strerror(errno), errno);
}
else
{