diff options
Diffstat (limited to 'toolbox/restorecon.c')
| -rw-r--r-- | toolbox/restorecon.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/toolbox/restorecon.c b/toolbox/restorecon.c index 5ef0ef1..f9f604f 100644 --- a/toolbox/restorecon.c +++ b/toolbox/restorecon.c @@ -7,8 +7,7 @@ #include <fts.h> #include <selinux/selinux.h> #include <selinux/label.h> - -#define FCPATH "/file_contexts" +#include <selinux/android.h> static struct selabel_handle *sehandle; static const char *progname; @@ -17,7 +16,7 @@ static int verbose; static void usage(void) { - fprintf(stderr, "usage: %s [-f file_contexts] [-nrRv] pathname...\n", progname); + fprintf(stderr, "usage: %s [-nrRv] pathname...\n", progname); exit(1); } @@ -54,21 +53,16 @@ static int restore(const char *pathname, const struct stat *sb) int restorecon_main(int argc, char **argv) { - struct selinux_opt seopts[] = { - { SELABEL_OPT_PATH, FCPATH } - }; int ch, recurse = 0, ftsflags = FTS_PHYSICAL; + int i = 0; progname = argv[0]; do { - ch = getopt(argc, argv, "f:nrRv"); + ch = getopt(argc, argv, "nrRv"); if (ch == EOF) break; switch (ch) { - case 'f': - seopts[0].value = optarg; - break; case 'n': nochange = 1; break; @@ -89,9 +83,10 @@ int restorecon_main(int argc, char **argv) if (!argc) usage(); - sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1); + sehandle = selinux_android_file_context_handle(); + if (!sehandle) { - fprintf(stderr, "Could not load file contexts from %s: %s\n", seopts[0].value, + fprintf(stderr, "Could not load file_contexts: %s\n", strerror(errno)); return -1; } |
