summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'libappfuse/FuseBridgeLoop.cc')
-rw-r--r--libappfuse/FuseBridgeLoop.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/libappfuse/FuseBridgeLoop.cc b/libappfuse/FuseBridgeLoop.cc
index acb963cfc..beee4a6f5 100644
--- a/libappfuse/FuseBridgeLoop.cc
+++ b/libappfuse/FuseBridgeLoop.cc
@@ -26,6 +26,7 @@ bool FuseBridgeLoop::Start(
26 base::unique_fd dev_fd(raw_dev_fd); 26 base::unique_fd dev_fd(raw_dev_fd);
27 base::unique_fd proxy_fd(raw_proxy_fd); 27 base::unique_fd proxy_fd(raw_proxy_fd);
28 fuse::FuseBuffer buffer; 28 fuse::FuseBuffer buffer;
29 size_t open_count = 0;
29 30
30 LOG(DEBUG) << "Start fuse loop."; 31 LOG(DEBUG) << "Start fuse loop.";
31 while (true) { 32 while (true) {
@@ -71,8 +72,26 @@ bool FuseBridgeLoop::Start(
71 return false; 72 return false;
72 } 73 }
73 74
74 if (opcode == FUSE_INIT) { 75 switch (opcode) {
75 callback->OnMount(); 76 case FUSE_INIT:
77 callback->OnMount();
78 break;
79 case FUSE_OPEN:
80 if (buffer.response.header.error == fuse::kFuseSuccess) {
81 open_count++;
82 }
83 break;
84 case FUSE_RELEASE:
85 if (open_count != 0) {
86 open_count--;
87 } else {
88 LOG(WARNING) << "Unexpected FUSE_RELEASE before opening a file.";
89 break;
90 }
91 if (open_count == 0) {
92 return true;
93 }
94 break;
76 } 95 }
77 } 96 }
78} 97}