From 4a4858185177616707dda7ab562f45a0a8494e3f Mon Sep 17 00:00:00 2001
From: Jeff Sharkey <jsharkey@android.com>
Date: Tue, 30 Jun 2015 16:02:40 -0700
Subject: [PATCH] Gracefully handle ENODEV in sdcard daemon.

When someone force-unmounts our target endpoint, gracefully handle by
terminating, instead of looping on the same errno forever.

Bug: 22197797
Change-Id: I7e71632f69d47152ea78a94431c23ae69aba9b93
---
 sdcard/sdcard.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index a136232e26..3cd5bc4c56 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -1510,6 +1510,10 @@ static void handle_fuse_requests(struct fuse_handler* handler)
             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);
+            }
             continue;
         }
 
-- 
GitLab