system/core
Revision | 83e9f6bd6882583d726661309bfe6ea77d43ac6c (tree) |
---|---|
Zeit | 2019-05-14 09:25:22 |
Autor | TreeHugger Robot <treehugger-gerrit@goog...> |
Commiter | Android (Google) Code Review |
Merge "fs_mgr: overlayfs: ReadFstabFromFile touches errno" into qt-dev
@@ -704,7 +704,9 @@ bool SkipMountingPartitions(Fstab* fstab) { | ||
704 | 704 | constexpr const char kSkipMountConfig[] = "/system/etc/init/config/skip_mount.cfg"; |
705 | 705 | |
706 | 706 | std::string skip_config; |
707 | + auto save_errno = errno; | |
707 | 708 | if (!ReadFileToString(kSkipMountConfig, &skip_config)) { |
709 | + errno = save_errno; // missing file is expected | |
708 | 710 | return true; |
709 | 711 | } |
710 | 712 |
@@ -139,7 +139,11 @@ bool fs_mgr_filesystem_has_space(const std::string& mount_point) { | ||
139 | 139 | // If we have access issues to find out space remaining, return true |
140 | 140 | // to prevent us trying to override with overlayfs. |
141 | 141 | struct statvfs vst; |
142 | - if (statvfs(mount_point.c_str(), &vst)) return true; | |
142 | + auto save_errno = errno; | |
143 | + if (statvfs(mount_point.c_str(), &vst)) { | |
144 | + errno = save_errno; | |
145 | + return true; | |
146 | + } | |
143 | 147 | |
144 | 148 | static constexpr int kPercentThreshold = 1; // 1% |
145 | 149 |
@@ -265,9 +269,11 @@ bool fs_mgr_rw_access(const std::string& path) { | ||
265 | 269 | |
266 | 270 | bool fs_mgr_overlayfs_already_mounted(const std::string& mount_point, bool overlay_only = true) { |
267 | 271 | Fstab fstab; |
272 | + auto save_errno = errno; | |
268 | 273 | if (!ReadFstabFromFile("/proc/mounts", &fstab)) { |
269 | 274 | return false; |
270 | 275 | } |
276 | + errno = save_errno; | |
271 | 277 | const auto lowerdir = kLowerdirOption + mount_point; |
272 | 278 | for (const auto& entry : fstab) { |
273 | 279 | if (overlay_only && "overlay" != entry.fs_type && "overlayfs" != entry.fs_type) continue; |