Quick fix to correctly handle empty file/channel handles.
Empty file/channel handles (value < 0) should result in a negative
FileReference/ChannelReference value. The original code incorrectly
interpreted the negative reference value as an error, causing errno
to be returned. In most cases errno is 0, leading to confusion
across the wire when the deserialization logic attempts to lookup an
invalid, but non-empty reference.
Bug: None
Test: bufferhub_tests passes
Change-Id: I664daf3cdc178fe2c4ca0c44eef35a8bb9c7310d
diff --git a/libs/vr/libpdx/service.cpp b/libs/vr/libpdx/service.cpp
index daf9af8..d2804d5 100644
--- a/libs/vr/libpdx/service.cpp
+++ b/libs/vr/libpdx/service.cpp
@@ -129,7 +129,7 @@
PDX_TRACE_NAME("Message::PushFileHandle");
if (auto svc = service_.lock()) {
ErrnoGuard errno_guard;
- return ReturnCodeOrError(svc->endpoint()->PushFileHandle(this, handle));
+ return svc->endpoint()->PushFileHandle(this, handle);
} else {
return -ESHUTDOWN;
}
@@ -139,7 +139,7 @@
PDX_TRACE_NAME("Message::PushFileHandle");
if (auto svc = service_.lock()) {
ErrnoGuard errno_guard;
- return ReturnCodeOrError(svc->endpoint()->PushFileHandle(this, handle));
+ return svc->endpoint()->PushFileHandle(this, handle);
} else {
return -ESHUTDOWN;
}
@@ -149,7 +149,7 @@
PDX_TRACE_NAME("Message::PushFileHandle");
if (auto svc = service_.lock()) {
ErrnoGuard errno_guard;
- return ReturnCodeOrError(svc->endpoint()->PushFileHandle(this, handle));
+ return svc->endpoint()->PushFileHandle(this, handle);
} else {
return -ESHUTDOWN;
}
@@ -159,7 +159,7 @@
PDX_TRACE_NAME("Message::PushChannelHandle");
if (auto svc = service_.lock()) {
ErrnoGuard errno_guard;
- return ReturnCodeOrError(svc->endpoint()->PushChannelHandle(this, handle));
+ return svc->endpoint()->PushChannelHandle(this, handle);
} else {
return -ESHUTDOWN;
}
@@ -170,7 +170,7 @@
PDX_TRACE_NAME("Message::PushChannelHandle");
if (auto svc = service_.lock()) {
ErrnoGuard errno_guard;
- return ReturnCodeOrError(svc->endpoint()->PushChannelHandle(this, handle));
+ return svc->endpoint()->PushChannelHandle(this, handle);
} else {
return -ESHUTDOWN;
}
@@ -180,7 +180,7 @@
PDX_TRACE_NAME("Message::PushChannelHandle");
if (auto svc = service_.lock()) {
ErrnoGuard errno_guard;
- return ReturnCodeOrError(svc->endpoint()->PushChannelHandle(this, handle));
+ return svc->endpoint()->PushChannelHandle(this, handle);
} else {
return -ESHUTDOWN;
}