Skip to content

Commit

Permalink
Merge "Ensure that app lib symlinks are correctly labeled when create…
Browse files Browse the repository at this point in the history
…d." into cm-11.0
  • Loading branch information
rmcc authored and Gerrit Code Review committed May 29, 2014
2 parents a852d21 + 5732bf1 commit e29da25
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cmds/installd/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ int install(const char *pkgname, uid_t uid, gid_t gid, const char *seinfo)
}
}

if (symlink(applibdir, libsymlink) < 0) {
ALOGE("couldn't symlink directory '%s' -> '%s': %s\n", libsymlink, applibdir,
strerror(errno));
unlink(pkgdir);
return -1;
}

if (selinux_android_setfilecon(pkgdir, pkgname, seinfo, uid) < 0) {
ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
unlink(pkgdir);
return -errno;
}

if (symlink(applibdir, libsymlink) < 0) {
ALOGE("couldn't symlink directory '%s' -> '%s': %s\n", libsymlink, applibdir,
strerror(errno));
unlink(pkgdir);
return -1;
}

if (chown(pkgdir, uid, gid) < 0) {
ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
Expand Down Expand Up @@ -240,20 +240,20 @@ int make_user_data(const char *pkgname, uid_t uid, userid_t userid, const char*
}
}

if (symlink(applibdir, libsymlink) < 0) {
ALOGE("couldn't symlink directory for non-primary '%s' -> '%s': %s\n", libsymlink,
applibdir, strerror(errno));
unlink(pkgdir);
return -1;
}

if (selinux_android_setfilecon(pkgdir, pkgname, seinfo, uid) < 0) {
ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
unlink(pkgdir);
return -errno;
}

if (symlink(applibdir, libsymlink) < 0) {
ALOGE("couldn't symlink directory for non-primary '%s' -> '%s': %s\n", libsymlink,
applibdir, strerror(errno));
unlink(pkgdir);
return -1;
}

if (chown(pkgdir, uid, uid) < 0) {
ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
Expand Down

0 comments on commit e29da25

Please sign in to comment.