Rectify Boottime property
__mount gets called multiple times. Set the read-only property only upon
success since it can't be set multiple times. Selinux disallows modifying
read-only property and therefore the property holds a wrong value, the one
when __mount was called first even in case the call failed.
Bug: 224824099
Signed-off-by: Padmanabha V <padmanabha.v@sasken.com>
Change-Id: If2900fcf988b6225bb0f96586b00b97386ca8a81
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 6863894..d13f4d1 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -840,8 +840,10 @@
if ((ret == 0) && (mountflags & MS_RDONLY) != 0) {
fs_mgr_set_blk_ro(source);
}
- android::base::SetProperty("ro.boottime.init.mount." + Basename(target),
- std::to_string(t.duration().count()));
+ if (ret == 0) {
+ android::base::SetProperty("ro.boottime.init.mount." + Basename(target),
+ std::to_string(t.duration().count()));
+ }
errno = save_errno;
return ret;
}