cnping

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

commit 0bbc0b2234436e25baa06530400f23ae870ea42e
parent 2af4ff9594498ba37ebcb652b99aa1352f9db6f5
Author: Niklas Mischkulnig <mischnic@users.noreply.github.com>
Date:   Tue, 17 Jul 2018 23:33:24 +0200

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 )