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

Commit 1accab96 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Use PLOG instead of printing errno

Also, print error message where the error code is available through
other means than errno.

Test: it builds
Change-Id: I0276c4bcd50debc0003aab4e3229ea33ac79f3ac
parent b132f556
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ bool NetlinkSocket::receiveAck() {
        // Found error/ack message, return status.
        auto nlerr = reinterpret_cast<struct nlmsgerr*>(NLMSG_DATA(nlmsg));
        if (nlerr->error != 0) {
            LOG(ERROR) << "Received Netlink error message: " << nlerr->error;
            LOG(ERROR) << "Received Netlink error message: " << strerror(-nlerr->error);
            return false;
        }
        return true;
+2 −3
Original line number Diff line number Diff line
@@ -28,9 +28,8 @@ unsigned int nametoindex(const std::string& ifname) {
    const auto ifidx = if_nametoindex(ifname.c_str());
    if (ifidx != 0) return ifidx;

    const auto err = errno;
    if (err != ENODEV) {
        LOG(ERROR) << "if_nametoindex(" << ifname << ") failed: " << err;
    if (errno != ENODEV) {
        PLOG(ERROR) << "if_nametoindex(" << ifname << ") failed";
    }
    return 0;
}