summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Lawrence <paullawrence@google.com>2015-06-12 13:06:21 -0700
committerPaul Lawrence <paullawrence@google.com>2015-06-12 13:06:21 -0700
commit2fa9e939581d944f0204291c53356d6b8c3a938f (patch)
treebe0a62987f6a886114eb32844bfbbb1f0883f794
parent2297612246852bd0993e949ceccafd4a36f3a053 (diff)
downloadextras-2fa9e939581d944f0204291c53356d6b8c3a938f.tar.gz
Retry polling to prevent failures
Change-Id: I182ee7f70c5a96bbcdb0fc9e35df67c45a937757
-rw-r--r--ext4_utils/ext4_crypt_init_extensions.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp
index 7ae076a3..3fb04b98 100644
--- a/ext4_utils/ext4_crypt_init_extensions.cpp
+++ b/ext4_utils/ext4_crypt_init_extensions.cpp
@@ -60,18 +60,19 @@ static std::string vold_command(std::string const& command)
struct pollfd poll_sock = {sock, POLLIN, 0};
- int rc = poll(&poll_sock, 1, vold_command_timeout_ms);
+ int rc = TEMP_FAILURE_RETRY(poll(&poll_sock, 1, vold_command_timeout_ms));
if (rc < 0) {
KLOG_ERROR(TAG, "Error in poll %s\n", strerror(errno));
return "";
}
+
if (!(poll_sock.revents & POLLIN)) {
KLOG_ERROR(TAG, "Timeout\n");
return "";
}
char buffer[4096];
memset(buffer, 0, sizeof(buffer));
- rc = read(sock, buffer, sizeof(buffer));
+ rc = TEMP_FAILURE_RETRY(read(sock, buffer, sizeof(buffer)));
if (rc <= 0) {
if (rc == 0) {
KLOG_ERROR(TAG, "Lost connection to Vold - did it crash?\n");