Merge "Avoid two SELinux related error messages at boot time" into main
This commit is contained in:
commit
87d6c8a1d5
1 changed files with 11 additions and 3 deletions
|
|
@ -735,6 +735,14 @@ void SelinuxAvcLog(char* buf) {
|
||||||
TEMP_FAILURE_RETRY(send(fd.get(), &request, sizeof(request), 0));
|
TEMP_FAILURE_RETRY(send(fd.get(), &request, sizeof(request), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RestoreconIfExists(const char* path, unsigned int flags) {
|
||||||
|
if (access(path, F_OK) != 0 && errno == ENOENT) {
|
||||||
|
// Avoid error message for path that is expected to not always exist.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return selinux_android_restorecon(path, flags);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void SelinuxRestoreContext() {
|
void SelinuxRestoreContext() {
|
||||||
|
|
@ -762,9 +770,9 @@ void SelinuxRestoreContext() {
|
||||||
|
|
||||||
// adb remount, snapshot-based updates, and DSUs all create files during
|
// adb remount, snapshot-based updates, and DSUs all create files during
|
||||||
// first-stage init.
|
// first-stage init.
|
||||||
selinux_android_restorecon(SnapshotManager::GetGlobalRollbackIndicatorPath().c_str(), 0);
|
RestoreconIfExists(SnapshotManager::GetGlobalRollbackIndicatorPath().c_str(), 0);
|
||||||
selinux_android_restorecon("/metadata/gsi", SELINUX_ANDROID_RESTORECON_RECURSE |
|
RestoreconIfExists("/metadata/gsi",
|
||||||
SELINUX_ANDROID_RESTORECON_SKIP_SEHASH);
|
SELINUX_ANDROID_RESTORECON_RECURSE | SELINUX_ANDROID_RESTORECON_SKIP_SEHASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SelinuxKlogCallback(int type, const char* fmt, ...) {
|
int SelinuxKlogCallback(int type, const char* fmt, ...) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue