Revert "Revert "rootdir / sdcard : Stop creating /data/media/obb.""
This reverts commit 891a0113941136544509886c1638d973a6c9773c.
Reason for revert: Some Test failed, need more investigation
Bug: 136199978
Change-Id: Ibad0dad02a6701447c39ddcc805d44c9e68bdcce
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 1b7367c..2601997 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -586,7 +586,6 @@
symlink /data/data /data/user/0
mkdir /data/media 0770 media_rw media_rw
- mkdir /data/media/obb 0770 media_rw media_rw
mkdir /data/cache 0770 system cache
mkdir /data/cache/recovery 0770 system cache
diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp
index 2b35819..0acea72 100644
--- a/sdcard/sdcard.cpp
+++ b/sdcard/sdcard.cpp
@@ -214,7 +214,14 @@
if (multi_user) {
std::string obb_path = source_path + "/obb";
- fs_prepare_dir(obb_path.c_str(), 0775, uid, gid);
+ // Only attempt to prepare the /obb dir if it already exists. We want
+ // the legacy obb path "/data/media/obb" to be fixed up so that we can
+ // migrate it to its new location, but we don't want the directory to be
+ // created if it doesn't already exist.
+ struct stat sb;
+ if (TEMP_FAILURE_RETRY(lstat(obb_path.c_str(), &sb)) == 0) {
+ fs_prepare_dir(obb_path.c_str(), 0775, uid, gid);
+ }
}
exit(0);