Merge "Fix run-as for non-owner users"

This commit is contained in:
Treehugger Robot 2018-11-06 01:17:37 +00:00 committed by Gerrit Code Review
commit a123155f3e

View file

@ -167,6 +167,15 @@ int main(int argc, char* argv[]) {
if (!packagelist_parse(packagelist_parse_callback, &info)) {
error(1, errno, "packagelist_parse failed");
}
// Handle a multi-user data path
if (userId > 0) {
free(info.data_dir);
if (asprintf(&info.data_dir, "/data/user/%d/%s", userId, pkgname) == -1) {
error(1, errno, "asprintf failed");
}
}
if (info.uid == 0) {
error(1, 0, "unknown package: %s", pkgname);
}