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/be440ec2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/be440ec2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/be440ec2

Branch: refs/heads/0.28.x
Commit: be440ec224dc5c1b69569dd043d5127131f27a7a
Parents: 1ccc079
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:18:45 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/be440ec2/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 c0fd1d6..41ac41e 100644
--- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
@@ -745,7 +745,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