summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2020-02-19 11:25:08 -0800
committerPeter Collingbourne <pcc@google.com>2020-02-20 13:56:00 -0800
commitc77052eb208e293f5a9c97b41f470edee8e11c46 (patch)
tree4f64ec8810d0dbda2faaab3741ffd83077f0e4c6
parent9170b3105e9c6decd3e15a693584f410a0188234 (diff)
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>
-rw-r--r--drm/drmdevice.cpp2
-rw-r--r--drm/drmeventlistener.cpp4
2 files changed, 3 insertions, 3 deletions
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 @@ std::tuple<int, int> DrmDevice::Init(const char *path, int num_displays) {
/* 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 @@ DrmEventListener::DrmEventListener(DrmDevice *drm)
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 DrmEventListener::Init() {
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;
}