SO_NOSIGPIPE

Sascha Wildner saw at online.de
Sat Mar 12 06:55:05 PST 2011


On 3/12/2011 0:17, Pierre Abbat wrote:
I'm trying to compile Bitcoin and I get the following (after configuring
wxWidgets correctly and installing a few packages):
# gmake -f ./makefile.unix
g++ -c -O2 -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -D__WXGTK__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL -I"/usr/local/include/wx-2.9" -I"/usr/pkg/include" -I"/usr/pkg/include/db5" -I"/usr/local/lib/wx/include/gtk2-unicode-static-2.9" -DGUI -o
obj/net.o net.cpp
net.cpp: In function 'bool ConnectSocket(const CAddress&, SOCKET&)':
net.cpp:70: error: 'SO_NOSIGPIPE' was not declared in this scope
net.cpp: In function 'bool BindListenPort(std::string&)':
net.cpp:1254: error: 'SO_NOSIGPIPE' was not declared in this scope
gmake: *** [obj/net.o] Error 1
I look at net.cpp and find this:

#ifdef BSD
     int set = 1;
     setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int));
#endif
#ifdef BSD
     // Different way of disabling SIGPIPE on BSD
     setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne,
sizeof(int
));
#endif
Is something else missing from an include file, or is there no SO_NOSIGPIPE on
DFly?
No, there isn't.

Same goes for NetBSD and OpenBSD. Someone obviously confuses FreeBSD 
with BSD there. But hey, that's still better than confusing "portable" 
with "should compile on all Linux distros". :)

A saner way would be to replace those "#ifdef BSD" with "#ifdef 
SO_NOSIGPIPE" in order to check if the system allows turning off SIGPIPE 
for a socket. This is how for example BIND does it.

Try that.

Sascha





More information about the Users mailing list