From 26288202e7bdf2e897a11bf31a15685d7c20945f Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Fri, 7 Feb 2014 09:16:46 -0500 Subject: [PATCH] Convert all selinux_android_restorecon and _setfilecon calls to new API. libselinux selinux_android_restorecon API is changing to the more general interface with flags and dropping the older variants. Also get rid of the old, no longer used selinux_android_setfilecon API and rename selinux_android_setfilecon2 to it as it is the only API in use. Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925 Signed-off-by: Stephen Smalley --- cmds/dumpstate/utils.c | 2 +- cmds/installd/commands.c | 4 ++-- cmds/installd/installd.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c index fe716acfe..670e09cc8 100644 --- a/cmds/dumpstate/utils.c +++ b/cmds/dumpstate/utils.c @@ -469,7 +469,7 @@ const char *dump_traces() { if (!mkdir(anr_traces_dir, 0775)) { chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM); chmod(anr_traces_dir, 0775); - if (selinux_android_restorecon(anr_traces_dir) == -1) { + if (selinux_android_restorecon(anr_traces_dir, 0) == -1) { fprintf(stderr, "restorecon failed for %s: %s\n", anr_traces_dir, strerror(errno)); } } else if (errno != EEXIST) { diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index 6fed798e1..fdeae57a3 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -91,7 +91,7 @@ int install(const char *pkgname, uid_t uid, gid_t gid, const char *seinfo) return -1; } - if (selinux_android_setfilecon2(pkgdir, pkgname, seinfo, uid) < 0) { + if (selinux_android_setfilecon(pkgdir, pkgname, seinfo, uid) < 0) { ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno)); unlink(libsymlink); unlink(pkgdir); @@ -245,7 +245,7 @@ int make_user_data(const char *pkgname, uid_t uid, userid_t userid, const char* return -1; } - if (selinux_android_setfilecon2(pkgdir, pkgname, seinfo, uid) < 0) { + if (selinux_android_setfilecon(pkgdir, pkgname, seinfo, uid) < 0) { ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno)); unlink(libsymlink); unlink(pkgdir); diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c index 0c80dac3b..03acafd40 100644 --- a/cmds/installd/installd.c +++ b/cmds/installd/installd.c @@ -392,7 +392,7 @@ int initialize_directories() { goto fail; } - if (selinux_android_restorecon(android_media_dir.path)) { + if (selinux_android_restorecon(android_media_dir.path, 0)) { goto fail; }