Change /dalvik-cache to be owned by root.

Bug: 16875245

(cherry picked from commit 79bf4007f5)

Change-Id: I29a70215a2207bc4e0db02ab751d32a68edf4b66
This commit is contained in:
Alex Light
2014-08-27 15:39:17 -07:00
parent 371bee50f9
commit 55471dcd0f

View File

@@ -161,17 +161,17 @@ static void maybeCreateDalvikCache() {
LOG_ALWAYS_FATAL_IF((numChars >= PATH_MAX || numChars < 0),
"Error constructing dalvik cache : %s", strerror(errno));
int result = mkdir(dalvikCacheDir, 0771);
int result = mkdir(dalvikCacheDir, 0711);
LOG_ALWAYS_FATAL_IF((result < 0 && errno != EEXIST),
"Error creating cache dir %s : %s", dalvikCacheDir, strerror(errno));
// We always perform these steps because the directory might
// already exist, with wider permissions and a different owner
// than we'd like.
result = chown(dalvikCacheDir, AID_SYSTEM, AID_SYSTEM);
result = chown(dalvikCacheDir, AID_ROOT, AID_ROOT);
LOG_ALWAYS_FATAL_IF((result < 0), "Error changing dalvik-cache ownership : %s", strerror(errno));
result = chmod(dalvikCacheDir, 0771);
result = chmod(dalvikCacheDir, 0711);
LOG_ALWAYS_FATAL_IF((result < 0),
"Error changing dalvik-cache permissions : %s", strerror(errno));
}