Checked correct file descriptor after call to `dup`.

Review: https://reviews.apache.org/r/51839/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d9a9b47d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d9a9b47d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d9a9b47d

Branch: refs/heads/0.27.x
Commit: d9a9b47d6d38d1ba98bf1c6ee9a6c187c31f0c28
Parents: 0e51b6c
Author: Benjamin Bannier <benjamin.bann...@mesosphere.io>
Authored: Tue Sep 13 11:43:19 2016 +0200
Committer: Joseph Wu <josep...@apache.org>
Committed: Thu Sep 15 10:22:21 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/libevent_ssl_socket.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d9a9b47d/3rdparty/libprocess/src/libevent_ssl_socket.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/libevent_ssl_socket.cpp 
b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
index 34182d2..5eaac9a 100644
--- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
@@ -747,7 +747,7 @@ Future<size_t> LibeventSSLSocketImpl::sendfile(
   // we may use `evbuffer_file_segment_new` and `evbuffer_add_file_segment`
   // instead of `evbuffer_add_file`.
   int owned_fd = dup(fd);
-  if (fd == -1) {
+  if (owned_fd < 0) {
     return Failure(ErrnoError("Failed to duplicate file descriptor"));
   }
 

Reply via email to