cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

commit 1442e55e56b5b9de89711bc9b32b88aee6d87ef2
parent 2af4ff9594498ba37ebcb652b99aa1352f9db6f5
Author: CNLohr <charles@cnlohr.com>
Date:   Wed, 18 Jul 2018 01:11:04 -0400

Merge pull request #47 from mischnic/mac

Fix compile errors on macOS (MSG_NOSIGNAL)
Diffstat:
MMakefile | 2+-
Mhttping.c | 13+++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -17,7 +17,7 @@ cnping.exe : cnping.c CNFGFunctions.c CNFGWinDriver.c os_generic.c ping.c httpin cnping : cnping.o CNFGFunctions.o CNFGXDriver.o os_generic.o ping.o httping.o gcc $(CFLAGS) -o $@ $^ -lX11 -lm -lpthread $(LDFLAGS) -cnping_mac : cnping.c CNFGFunctions.c CNFGCocoaCGDriver.m os_generic.c ping.c +cnping_mac : cnping.c CNFGFunctions.c CNFGCocoaCGDriver.m os_generic.c ping.c httping.o gcc -o cnping $^ -x objective-c -framework Cocoa -framework QuartzCore -lm -lpthread searchnet : os_generic.o ping.o searchnet.o diff --git a/httping.c b/httping.c @@ -6,12 +6,12 @@ #include <unistd.h> #include <sys/types.h> -#ifdef WIN32 - #include <winsock2.h> - #ifndef MSG_NOSIGNAL +#ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 - #endif +#endif +#ifdef WIN32 + #include <winsock2.h> #else #include <sys/socket.h> #include <netinet/in.h> @@ -86,6 +86,11 @@ reconnect: goto fail; } +#ifdef __APPLE__ + int opt = 1; + setsockopt(httpsock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt)); +#endif + errbuffer[0] = 0; while( 1 )