Commit 8a7b843c authored by Torne (Richard Coles)'s avatar Torne (Richard Coles) Committed by Commit Bot

android: create cache dir if needed.

When using a subdirectory of the Android cache dir (e.g. in WebView),
explicitly create the directory in PathUtils instead of relying on any
user of the directory creating it implicitly.

Set the directory mode to 02700 which is what it currently gets set to
when created implicitly.

Fixed: 963640
Change-Id: I8e1c140241d6a2decfcd27186b767ef05e7a4320
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432447Reviewed-by: default avatarAnna Malova <amalova@chromium.org>
Commit-Queue: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811257}
parent 97d9fd6f
......@@ -108,8 +108,11 @@ public abstract class PathUtils {
if (sCacheSubDirectory == null) {
paths[CACHE_DIRECTORY] = appContext.getCacheDir().getPath();
} else {
paths[CACHE_DIRECTORY] =
new File(appContext.getCacheDir(), sCacheSubDirectory).getPath();
File cacheDir = new File(appContext.getCacheDir(), sCacheSubDirectory);
assert cacheDir.mkdir();
paths[CACHE_DIRECTORY] = cacheDir.getPath();
// Set to rwx--S--- as the Android cache dir has a distinct gid and is setgid.
chmod(paths[CACHE_DIRECTORY], 02700);
}
}
return paths;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment