view toys/android/runcon.c @ 1776:7bf68329eb3b draft default tip

Repository switched to git at https://github.com/landley/toybox
author Rob Landley <rob@landley.net>
date Thu, 09 Apr 2015 02:28:32 -0500
parents 0f940c4f9658
children
line wrap: on
line source

/* runcon.c - Run command in specified security context
 *
 * Copyright 2015 The Android Open Source Project

USE_RUNCON(NEWTOY(runcon, "<2", TOYFLAG_USR|TOYFLAG_SBIN))

config RUNCON
  bool "runcon"
  depends on TOYBOX_SELINUX
  default y
  help
    usage: runcon CONTEXT COMMAND [ARGS...]

    Run a command in a specified security context.
*/

#define FOR_runcon
#include "toys.h"

void runcon_main(void)
{
  char *context = *toys.optargs;

  if (setexeccon(context)) perror_exit("Could not set context to %s", context);

  xexec(++toys.optargs);
}