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
diff --git a/automotive/can/1.0/default/libnetdevice/common.cpp b/automotive/can/1.0/default/libnetdevice/common.cpp
index 103cf53..387c91f 100644
--- a/automotive/can/1.0/default/libnetdevice/common.cpp
+++ b/automotive/can/1.0/default/libnetdevice/common.cpp
@@ -28,9 +28,8 @@
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;
}