Fix link failure on some platforms when PAM is enabled
[oweals/busybox.git] / selinux / runcon.c
index b70a5e396bbec17026bf45b9834186f63c331b1e..3183a2274e01f3cc3588286cc77d74ad04c17760 100644 (file)
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
-#include <getopt.h>
+
+//usage:#define runcon_trivial_usage
+//usage:       "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n"
+//usage:       "runcon CONTEXT PROG ARGS"
+//usage:#define runcon_full_usage "\n\n"
+//usage:       "Run PROG in a different security context\n"
+//usage:     "\n       CONTEXT         Complete security context\n"
+//usage:       IF_FEATURE_RUNCON_LONG_OPTIONS(
+//usage:     "\n       -c,--compute    Compute process transition context before modifying"
+//usage:     "\n       -t,--type=TYPE  Type (for same role as parent)"
+//usage:     "\n       -u,--user=USER  User identity"
+//usage:     "\n       -r,--role=ROLE  Role"
+//usage:     "\n       -l,--range=RNG  Levelrange"
+//usage:       )
+//usage:       IF_NOT_FEATURE_RUNCON_LONG_OPTIONS(
+//usage:     "\n       -c      Compute process transition context before modifying"
+//usage:     "\n       -t TYPE Type (for same role as parent)"
+//usage:     "\n       -u USER User identity"
+//usage:     "\n       -r ROLE Role"
+//usage:     "\n       -l RNG  Levelrange"
+//usage:       )
+
 #include <selinux/context.h>
 #include <selinux/flask.h>
 
@@ -132,6 +153,5 @@ int runcon_main(int argc UNUSED_PARAM, char **argv)
                bb_error_msg_and_die("can't set up security context '%s'",
                                     context_str(con));
 
-       execvp(argv[0], argv);
-       bb_perror_msg_and_die("can't execute '%s'", argv[0]);
+       BB_EXECVP_or_die(argv);
 }