From 4053359c7fe4fe94f01f40f7d0eade0ab4912704 Mon Sep 17 00:00:00 2001 From: DuXiao Date: Mon, 21 May 2018 14:43:56 +0800 Subject: [PATCH] Property: Log errno for socket connect It's currently not clear that the error no indicating the failure to invoke the library function. This change introduces logs at the failing of socket connect, that could be clearly get the true reason. Test: Set system property with failed, and socket recv errno log will show Change-Id: I36bf66988811f953e679d1c5a468de0bf1ab0a05 Signed-off-by: Jinguang Dong --- init/property_service.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/property_service.cpp b/init/property_service.cpp index 47e45efeb..e79157029 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -371,6 +371,7 @@ class SocketConnection { int result = TEMP_FAILURE_RETRY(recv(socket_, data, bytes_left, MSG_DONTWAIT)); if (result <= 0) { + PLOG(ERROR) << "sys_prop: recv error"; return false; } @@ -378,6 +379,10 @@ class SocketConnection { data += result; } + if (bytes_left != 0) { + LOG(ERROR) << "sys_prop: recv data is not properly obtained."; + } + return bytes_left == 0; }