drm_hwcomposer: Improve error messages.
- Don't negate errno before passing to strerror, at least on
bionic this results in "Unknown error -x" instead of the actual
error.
- Fix another error message to print strerror(errno) instead of the
returned fd which will always be -1.
- Fix another error message to call strerror for consistency.
Signed-off-by: Peter Collingbourne <pcc@google.com>
diff --git a/drm/drmdevice.cpp b/drm/drmdevice.cpp
index bcb9ddd..bef41d8 100644
--- a/drm/drmdevice.cpp
+++ b/drm/drmdevice.cpp
@@ -126,7 +126,7 @@
/* TODO: Use drmOpenControl here instead */
fd_.Set(open(path, O_RDWR));
if (fd() < 0) {
- ALOGE("Failed to open dri- %s", strerror(-errno));
+ ALOGE("Failed to open dri %s: %s", path, strerror(errno));
return std::make_tuple(-ENODEV, 0);
}
diff --git a/drm/drmeventlistener.cpp b/drm/drmeventlistener.cpp
index 8f655a7..ccee0d6 100644
--- a/drm/drmeventlistener.cpp
+++ b/drm/drmeventlistener.cpp
@@ -38,7 +38,7 @@
int DrmEventListener::Init() {
uevent_fd_.Set(socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT));
if (uevent_fd_.get() < 0) {
- ALOGE("Failed to open uevent socket %d", uevent_fd_.get());
+ ALOGE("Failed to open uevent socket: %s", strerror(errno));
return uevent_fd_.get();
}
@@ -50,7 +50,7 @@
int ret = bind(uevent_fd_.get(), (struct sockaddr *)&addr, sizeof(addr));
if (ret) {
- ALOGE("Failed to bind uevent socket %d", -errno);
+ ALOGE("Failed to bind uevent socket: %s", strerror(errno));
return -errno;
}