diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp index 202a86a80..107e99a31 100644 --- a/init/first_stage_init.cpp +++ b/init/first_stage_init.cpp @@ -295,9 +295,6 @@ int FirstStageMain(int argc, char** argv) { // stage init CHECKCALL(mount("tmpfs", kSecondStageRes, "tmpfs", MS_NOEXEC | MS_NOSUID | MS_NODEV, "mode=0755,uid=0,gid=0")) - - // First stage init stores Mainline sepolicy here. - CHECKCALL(mkdir("/dev/selinux", 0744)); #undef CHECKCALL SetStdioToDevNull(argv); diff --git a/init/selinux.cpp b/init/selinux.cpp index 613798803..ab5b0a09d 100644 --- a/init/selinux.cpp +++ b/init/selinux.cpp @@ -525,7 +525,7 @@ const std::vector kApexSepolicy{"apex_file_contexts", "apex_propert "apex_service_contexts", "apex_seapp_contexts", "apex_test"}; -Result CreateTmpfsDirIfNeeded() { +Result CreateTmpfsDir() { mode_t mode = 0744; struct stat stat_data; if (stat(kTmpfsDir.c_str(), &stat_data) != 0) { @@ -539,6 +539,7 @@ Result CreateTmpfsDirIfNeeded() { if (!S_ISDIR(stat_data.st_mode)) { return Error() << kTmpfsDir << " exists and is not a directory."; } + LOG(WARNING) << "Directory " << kTmpfsDir << " already exists"; } // Need to manually call chmod because mkdir will create a folder with @@ -593,7 +594,7 @@ Result GetPolicyFromApex(const std::string& dir) { auto handle_guard = android::base::make_scope_guard([&handle] { CloseArchive(handle); }); - auto create = CreateTmpfsDirIfNeeded(); + auto create = CreateTmpfsDir(); if (!create.ok()) { return create.error(); }