summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaichi Hirono2017-05-12 02:24:48 -0500
committerDaichi Hirono2017-05-16 20:30:02 -0500
commit3df060d6d0e953bacee8e7899d18b404b5a7262f (patch)
treeea2ae330037fadb0abe7b79953490ceab3ed96db /libappfuse/FuseBuffer.cc
parenta0aaf24d628eaf5675ba505afa021f475deac22c (diff)
downloadplatform-system-core-3df060d6d0e953bacee8e7899d18b404b5a7262f.tar.gz
platform-system-core-3df060d6d0e953bacee8e7899d18b404b5a7262f.tar.xz
platform-system-core-3df060d6d0e953bacee8e7899d18b404b5a7262f.zip
Change the CHECK failure into function failure.
Previously we have CHECK in WriteInternal function to observe short writing. However it turns out short write can happen according to the bug report. To prevent app from crashing due to CHECK failure, the CL removes the CHECK and let WriteInternal return a failure value. Bug: 37561460 Test: libappfuse_tests, manually re-wrote the return value of write() and checked logcat. Change-Id: I6a1e233c3ddb8eb68f59e7c606ad0459b5ca2c6e
Diffstat (limited to 'libappfuse/FuseBuffer.cc')
-rw-r--r--libappfuse/FuseBuffer.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/libappfuse/FuseBuffer.cc b/libappfuse/FuseBuffer.cc
index b42a04954..fc738db6c 100644
--- a/libappfuse/FuseBuffer.cc
+++ b/libappfuse/FuseBuffer.cc
@@ -119,7 +119,12 @@ ResultOrAgain WriteInternal(const FuseMessage<T>* self, int fd, int sockflag, co
119 return ResultOrAgain::kFailure; 119 return ResultOrAgain::kFailure;
120 } 120 }
121 } 121 }
122 CHECK(static_cast<uint32_t>(result) == header.len); 122
123 if (static_cast<unsigned int>(result) != header.len) {
124 LOG(ERROR) << "Written bytes " << result << " is different from length in header "
125 << header.len;
126 return ResultOrAgain::kFailure;
127 }
123 return ResultOrAgain::kSuccess; 128 return ResultOrAgain::kSuccess;
124 } 129 }
125} 130}