Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84e41ca0 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

run-as: remove a special case.

This is a change for some system apps that have /data/user_de/0/ in the
package list, but it's easier to reason about and more consistent to
always go down the same path.

Bug: http://b/308990322
Test: treehugger
Change-Id: I479485655c61e8a31fb23f779c66d54b0bb476c0
parent 0ac91e1f
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -196,14 +196,6 @@ int main(int argc, char* argv[]) {
  }
  if (setegid(old_egid) == -1) error(1, errno, "couldn't restore egid");

  // 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);
  }
@@ -226,6 +218,12 @@ int main(int argc, char* argv[]) {
    error(1, 0, "package not debuggable: %s", pkgname);
  }

  // Ensure we have the right data path for the specific user.
  free(info.data_dir);
  if (asprintf(&info.data_dir, "/data/user/%d/%s", userId, pkgname) == -1) {
    error(1, errno, "asprintf failed");
  }

  // Check that the data directory path is valid.
  check_data_path(pkgname, info.data_dir, userAppId);