From 5caea3b72bf783d88c3fa36eb8cf97cc10a71170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Hu=C4=8Dko?= <34306779+granxarixia@users.noreply.github.com> Date: Sun, 13 Feb 2022 18:48:50 +0100 Subject: [PATCH] fix: invalid assert on event fd (#243) --- src/Connection.cpp | 4 ++-- src/Connection.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Connection.cpp b/src/Connection.cpp index c5488f0..7353a9c 100644 --- a/src/Connection.cpp +++ b/src/Connection.cpp @@ -73,7 +73,7 @@ Connection::~Connection() void Connection::requestName(const std::string& name) { SDBUS_CHECK_SERVICE_NAME(name); - + auto r = iface_->sd_bus_request_name(bus_.get(), name.c_str(), 0); SDBUS_THROW_ERROR_IF(r < 0, "Failed to request bus name", -r); } @@ -423,7 +423,7 @@ bool Connection::processPendingRequest() bool Connection::waitForNextRequest() { assert(bus_ != nullptr); - assert(eventFd_.fd != 0); + assert(eventFd_.fd >= 0); auto sdbusPollData = getEventLoopPollData(); struct pollfd fds[] = { diff --git a/src/Connection.h b/src/Connection.h index f2b1c04..5454dae 100644 --- a/src/Connection.h +++ b/src/Connection.h @@ -134,7 +134,7 @@ namespace sdbus::internal { { EventFd(); ~EventFd(); - int fd; + int fd{-1}; }; private: