From: andreaskoepke Date: Wed, 18 Jul 2007 11:12:58 +0000 (+0000) Subject: try to circumvent Mac OS X problems X-Git-Tag: release_tools_1_2_4_1~22 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=f2aa9fb41a3e147a3715c028eb091806083de5ac try to circumvent Mac OS X problems --- diff --git a/support/sdk/cpp/sf/sf.cpp b/support/sdk/cpp/sf/sf.cpp index fdf5ced4..c5adcb13 100644 --- a/support/sdk/cpp/sf/sf.cpp +++ b/support/sdk/cpp/sf/sf.cpp @@ -46,6 +46,10 @@ #include "serialcomm.h" #include "packetbuffer.h" +#ifdef __APPLE__ +#include +#include +#endif using namespace std; @@ -54,6 +58,11 @@ using namespace std; int main(int argc, char *argv[]) { +#ifdef __APPLE__ + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) + cerr << "Warning: failed to ignore SIGPIPE " << endl; +#endif + SFControl control; control.parseArgs(argc, argv); control.waitOnInput(); diff --git a/support/sdk/cpp/sf/sfcontrol.cpp b/support/sdk/cpp/sf/sfcontrol.cpp index 1920949d..c4758a25 100644 --- a/support/sdk/cpp/sf/sfcontrol.cpp +++ b/support/sdk/cpp/sf/sfcontrol.cpp @@ -452,7 +452,11 @@ bool SFControl::sendToClient(string message) const char* buffer = message.c_str(); while (length > 0) { +#ifdef __APPLE__ + int n = send(clientFD, buffer, length, 0); +#else int n = send(clientFD, buffer, length, MSG_NOSIGNAL); +#endif if (!(n > 0)) { return false; diff --git a/support/sdk/cpp/sf/tcpcomm.cpp b/support/sdk/cpp/sf/tcpcomm.cpp index 40baa35f..7e064993 100644 --- a/support/sdk/cpp/sf/tcpcomm.cpp +++ b/support/sdk/cpp/sf/tcpcomm.cpp @@ -158,7 +158,11 @@ int TCPComm::writeFD(int fd, const char *buffer, int count) int actual = 0; while (count > 0) { +#ifdef __APPLE__ + int n = send(fd, buffer, count, 0); +#else int n = send(fd, buffer, count, MSG_NOSIGNAL); +#endif if (n == -1) { return -1;