Gracefully handle ENODEV in sdcard daemon (part deux)

reorder to handle errno correctly and remove log stutter

Bug: 22197797
Bug: 22241640
Change-Id: I81e6b2ff15b6ea6e5e780bd3599bf1019ff36f26
This commit is contained in:
Mark Salyzyn 2015-07-06 10:00:36 -07:00
parent a65e402b61
commit 6b6c1bd996

View file

@ -1513,16 +1513,14 @@ static void handle_fuse_requests(struct fuse_handler* handler)
{
struct fuse* fuse = handler->fuse;
for (;;) {
ssize_t len = read(fuse->fd,
handler->request_buffer, sizeof(handler->request_buffer));
ssize_t len = TEMP_FAILURE_RETRY(read(fuse->fd,
handler->request_buffer, sizeof(handler->request_buffer)));
if (len < 0) {
if (errno != EINTR) {
ERROR("[%d] handle_fuse_requests: errno=%d\n", handler->token, errno);
}
if (errno == ENODEV) {
ERROR("[%d] someone stole our marbles!\n", handler->token);
exit(2);
}
ERROR("[%d] handle_fuse_requests: errno=%d\n", handler->token, errno);
continue;
}