Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94df31d8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix bogus error checking on unique_fd"

parents a1d74187 97ee109b
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -449,16 +449,18 @@ bool DnsTlsSocket::query(uint16_t id, const Slice query) {
}
}


void DnsTlsSocket::requestLoopShutdown() {
void DnsTlsSocket::requestLoopShutdown() {
    if (mEventFd != -1) {
        // Write a negative number to the eventfd.  This triggers an immediate shutdown.
        // Write a negative number to the eventfd.  This triggers an immediate shutdown.
        incrementEventFd(INT64_MIN);
        incrementEventFd(INT64_MIN);
    }
    }
}


bool DnsTlsSocket::incrementEventFd(const int64_t count) {
bool DnsTlsSocket::incrementEventFd(const int64_t count) {
    if (!mEventFd) {
    if (mEventFd == -1) {
        ALOGV("eventfd is not initialized");
        ALOGE("eventfd is not initialized");
        return false;
        return false;
    }
    }
    int written = write(mEventFd.get(), &count, sizeof(count));
    ssize_t written = write(mEventFd.get(), &count, sizeof(count));
    if (written != sizeof(count)) {
    if (written != sizeof(count)) {
        ALOGE("Failed to increment eventfd by %" PRId64, count);
        ALOGE("Failed to increment eventfd by %" PRId64, count);
        return false;
        return false;