system/vold
Révision | 822b459cf79074855b8237e0550941ca55a087ce (tree) |
---|---|
l'heure | 2020-06-01 20:30:29 |
Auteur | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Allow mounting a read-only exFAT file system
If exfat::Check() fails, re-check the file system in read-only mode.
The logic is similar to exfat::Mount().
@@ -42,17 +42,18 @@ bool IsSupported() { | ||
42 | 42 | status_t Check(const std::string& source) { |
43 | 43 | std::vector<std::string> cmd; |
44 | 44 | cmd.push_back(kFsckPath); |
45 | + cmd.push_back("-a"); | |
45 | 46 | cmd.push_back(source); |
46 | 47 | |
47 | 48 | int rc = ForkExecvp(cmd, sFsckUntrustedContext); |
48 | 49 | if (rc == 0) { |
49 | 50 | LOG(INFO) << "Check OK"; |
50 | 51 | return 0; |
51 | - } else { | |
52 | - LOG(ERROR) << "Check failed (code " << rc << ")"; | |
53 | - errno = EIO; | |
54 | - return -1; | |
55 | 52 | } |
53 | + | |
54 | + // don't write anything to the file system | |
55 | + cmd[1] = "-n"; | |
56 | + return ForkExecvp(cmd, sFsckUntrustedContext); | |
56 | 57 | } |
57 | 58 | |
58 | 59 | status_t Mount(const std::string& source, const std::string& target, int ownerUid, int ownerGid, |