Always symlink self/primary to /storage/emulated
This allows readlink(2) of /sdcard paths to work correctly
and return /storage/emulated/<userid> instead of
/mnt/user/<userid>/emulated/<userid>
Test: readlink /sdcard -> /storage/emulated/0
Bug: 135341433
Change-Id: I2cfa9cede02a93024e41d90f17c926a69ec6e052
diff --git a/Utils.cpp b/Utils.cpp
index a798b27..a66e33c 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -1056,7 +1056,7 @@
return -1;
}
linkpath += "/primary";
- Symlink(fuse_path + "/" + std::to_string(user_id), linkpath);
+ Symlink("/storage/emulated/" + std::to_string(user_id), linkpath);
std::string pass_through_linkpath(StringPrintf("/mnt/pass_through/%d/self", user_id));
result = PrepareDir(pass_through_linkpath, 0755, AID_ROOT, AID_ROOT);
@@ -1065,7 +1065,7 @@
return -1;
}
pass_through_linkpath += "/primary";
- Symlink(pass_through_path + "/" + std::to_string(user_id), pass_through_linkpath);
+ Symlink("/storage/emulated/" + std::to_string(user_id), pass_through_linkpath);
}
// Open fuse fd.