diff options
author | hcaseyal <hcaseyal@gmail.com> | 2018-10-16 09:01:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-16 09:01:52 -0700 |
commit | cf408bb222b4f310773582a93015c76e07101b7b (patch) | |
tree | 35b6e4973aa2c8026d6ddf06aec1a1f01ad44b05 /src/core | |
parent | 1eeb4a69915d504994216a2f93e422c1d79a89bd (diff) | |
parent | 3cdbee6cbc580629b64e0d92e745835ebb9bd95d (diff) |
Merge pull request #10859 from haorenfsa/master
fix: while using eventfd, a random fd will be closed when error occurs during creating eventfd
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lib/iomgr/wakeup_fd_eventfd.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/lib/iomgr/wakeup_fd_eventfd.cc b/src/core/lib/iomgr/wakeup_fd_eventfd.cc index dcf7dab71f..d68c9ada1f 100644 --- a/src/core/lib/iomgr/wakeup_fd_eventfd.cc +++ b/src/core/lib/iomgr/wakeup_fd_eventfd.cc @@ -32,12 +32,11 @@ #include "src/core/lib/profiling/timers.h" static grpc_error* eventfd_create(grpc_wakeup_fd* fd_info) { - int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); - if (efd < 0) { + fd_info->read_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); + fd_info->write_fd = -1; + if (fd_info->read_fd < 0) { return GRPC_OS_ERROR(errno, "eventfd"); } - fd_info->read_fd = efd; - fd_info->write_fd = -1; return GRPC_ERROR_NONE; } |