Index: src/platform-posix.cc |
diff --git a/src/platform-posix.cc b/src/platform-posix.cc |
index 66316594c8ce3fdfe90cc4fd296f08325b653eb5..3e143d2f6441f78929c4784384e20fbfca85b47b 100644 |
--- a/src/platform-posix.cc |
+++ b/src/platform-posix.cc |
@@ -1,4 +1,4 @@ |
-// Copyright 2011 the V8 project authors. All rights reserved. |
+// Copyright 2012 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -467,14 +467,16 @@ bool POSIXSocket::Shutdown() { |
int POSIXSocket::Send(const char* data, int len) const { |
+ if (len <= 0) return 0; |
int status = send(socket_, data, len, 0); |
- return status; |
+ return (status < 0) ? 0 : status; |
} |
int POSIXSocket::Receive(char* data, int len) const { |
+ if (len <= 0) return 0; |
int status = recv(socket_, data, len, 0); |
- return status; |
+ return (status < 0) ? 0 : status; |
} |