]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
try to circumvent Mac OS X problems
authorandreaskoepke <andreaskoepke>
Wed, 18 Jul 2007 11:12:58 +0000 (11:12 +0000)
committerandreaskoepke <andreaskoepke>
Wed, 18 Jul 2007 11:12:58 +0000 (11:12 +0000)
support/sdk/cpp/sf/sf.cpp
support/sdk/cpp/sf/sfcontrol.cpp
support/sdk/cpp/sf/tcpcomm.cpp

index fdf5ced473a7b001eb16346a6440cd2b3c39d2c1..c5adcb13ea4638fee8f54572d8a671a7aff6ff6b 100644 (file)
 #include "serialcomm.h"
 #include "packetbuffer.h"
 
+#ifdef __APPLE__
+#include <unistd.h>
+#include <signal.h>
+#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();
index 1920949d936306cc3c59e94bdb2c039c898404a5..c4758a25c1a315cfd5bebedcd16bfca589313fab 100644 (file)
@@ -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;
index 40baa35fcf3d80f8b2afb2d01b59c51d280dd2c7..7e064993a4947eb9968747aa80981bc0dd241a5b 100644 (file)
@@ -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;