aboutsummaryrefslogtreecommitdiff
path: root/selinux
diff options
context:
space:
mode:
Diffstat (limited to 'selinux')
-rw-r--r--selinux/chcon.c11
-rw-r--r--selinux/matchpathcon.c10
-rw-r--r--selinux/runcon.c9
-rw-r--r--selinux/sestatus.c3
-rw-r--r--selinux/setfiles.c20
5 files changed, 34 insertions, 19 deletions
diff --git a/selinux/chcon.c b/selinux/chcon.c
index 3cf9e928a..e77e9ded5 100644
--- a/selinux/chcon.c
+++ b/selinux/chcon.c
@@ -163,13 +163,16 @@ int chcon_main(int argc UNUSED_PARAM, char **argv)
char *fname;
int i, errors = 0;
- opt_complementary = "-1" /* at least 1 param */
- ":?" /* error if exclusivity constraints are violated */
+ getopt32long(argv, "^"
+ "Rchfu:r:t:l:v"
+ "\0"
+ "-1" /* at least 1 arg */
+ ":?" /* error if exclusivity constraints are violated */
#if ENABLE_LONG_OPTS
":\xff--urtl:u--\xff:r--\xff:t--\xff:l--\xff"
#endif
- ":f--v:v--f"; /* 'verbose' and 'quiet' are exclusive */
- getopt32long(argv, "Rchfu:r:t:l:v", chcon_longopts,
+ ":f--v:v--f" /* 'verbose' and 'quiet' are exclusive */
+ , chcon_longopts,
&user, &role, &type, &range, &reference_file
);
argv += optind;
diff --git a/selinux/matchpathcon.c b/selinux/matchpathcon.c
index 3388d0857..e57120d3b 100644
--- a/selinux/matchpathcon.c
+++ b/selinux/matchpathcon.c
@@ -58,9 +58,13 @@ int matchpathcon_main(int argc UNUSED_PARAM, char **argv)
unsigned opts;
char *fcontext, *prefix, *path;
- opt_complementary = "-1" /* at least one param reqd */
- ":?:f--p:p--f"; /* mutually exclusive */
- opts = getopt32(argv, "nNf:p:V", &fcontext, &prefix);
+ opts = getopt32(argv, "^"
+ "nNf:p:V"
+ "\0"
+ "-1" /* at least one param reqd */
+ ":?:f--p:p--f" /* mutually exclusive */
+ , &fcontext, &prefix
+ );
argv += optind;
if (opts & OPT_NOT_TRANS) {
diff --git a/selinux/runcon.c b/selinux/runcon.c
index 199da25c6..a5a394427 100644
--- a/selinux/runcon.c
+++ b/selinux/runcon.c
@@ -126,9 +126,12 @@ int runcon_main(int argc UNUSED_PARAM, char **argv)
selinux_or_die();
- opt_complementary = "-1";
- opts = getopt32long(argv, "r:t:u:l:ch", runcon_longopts,
- &role, &type, &user, &range);
+ opts = getopt32long(argv, "^"
+ "r:t:u:l:ch"
+ "\0" "-1",
+ runcon_longopts,
+ &role, &type, &user, &range
+ );
argv += optind;
if (!(opts & OPTS_CONTEXT_COMPONENT)) {
diff --git a/selinux/sestatus.c b/selinux/sestatus.c
index daf4b223b..6954aca70 100644
--- a/selinux/sestatus.c
+++ b/selinux/sestatus.c
@@ -167,8 +167,7 @@ int sestatus_main(int argc UNUSED_PARAM, char **argv)
const char *pol_path;
int rc;
- opt_complementary = "?0"; /* no arguments are required. */
- opts = getopt32(argv, "vb");
+ opts = getopt32(argv, "^" "vb" "\0" "=0"/*no arguments*/);
/* SELinux status: line */
rc = is_selinux_enabled();
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index 01106bd67..fca698296 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
@@ -610,17 +610,23 @@ int setfiles_main(int argc UNUSED_PARAM, char **argv)
set_matchpathcon_flags(matchpathcon_flags);
- opt_complementary = "vv:v--p:p--v:v--q:q--v";
/* Option order must match OPT_x definitions! */
if (applet_name[0] == 'r') { /* restorecon */
- flags = getopt32(argv, "de:*f:ilnpqrsvo:FWR",
- &exclude_dir, &input_filename, &out_filename, &verbose);
+ flags = getopt32(argv, "^"
+ "de:*f:ilnpqrsvo:FWR",
+ "\0" "vv:v--p:p--v:v--q:q--v";
+ &exclude_dir, &input_filename, &out_filename,
+ &verbose
+ );
} else { /* setfiles */
- flags = getopt32(argv, "de:*f:ilnpqr:svo:FW"
- IF_FEATURE_SETFILES_CHECK_OPTION("c:"),
+ flags = getopt32(argv, "^"
+ "de:*f:ilnpqr:svo:FW"
+ IF_FEATURE_SETFILES_CHECK_OPTION("c:"),
+ "\0" "vv:v--p:p--v:v--q:q--v";
&exclude_dir, &input_filename, &rootpath, &out_filename,
- IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
- &verbose);
+ IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
+ &verbose
+ );
}
argv += optind;