diff options
Diffstat (limited to 'selinux')
-rw-r--r-- | selinux/load_policy.c | 4 | ||||
-rw-r--r-- | selinux/setenforce.c | 4 | ||||
-rw-r--r-- | selinux/setfiles.c | 23 |
3 files changed, 14 insertions, 17 deletions
diff --git a/selinux/load_policy.c b/selinux/load_policy.c index 4bc873e81..ea7c9132a 100644 --- a/selinux/load_policy.c +++ b/selinux/load_policy.c | |||
@@ -7,11 +7,11 @@ | |||
7 | #include "libbb.h" | 7 | #include "libbb.h" |
8 | 8 | ||
9 | int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 9 | int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
10 | int load_policy_main(int argc, char **argv UNUSED_PARAM) | 10 | int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
11 | { | 11 | { |
12 | int rc; | 12 | int rc; |
13 | 13 | ||
14 | if (argc != 1) { | 14 | if (argv[1]) { |
15 | bb_show_usage(); | 15 | bb_show_usage(); |
16 | } | 16 | } |
17 | 17 | ||
diff --git a/selinux/setenforce.c b/selinux/setenforce.c index a2d04288b..45f82238c 100644 --- a/selinux/setenforce.c +++ b/selinux/setenforce.c | |||
@@ -21,11 +21,11 @@ static const char *const setenforce_cmd[] = { | |||
21 | }; | 21 | }; |
22 | 22 | ||
23 | int setenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 23 | int setenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
24 | int setenforce_main(int argc, char **argv) | 24 | int setenforce_main(int argc UNUSED_PARAM, char **argv) |
25 | { | 25 | { |
26 | int i, rc; | 26 | int i, rc; |
27 | 27 | ||
28 | if (argc != 2) | 28 | if (!argv[1] || argv[2]) |
29 | bb_show_usage(); | 29 | bb_show_usage(); |
30 | 30 | ||
31 | selinux_or_die(); | 31 | selinux_or_die(); |
diff --git a/selinux/setfiles.c b/selinux/setfiles.c index 0a4643784..4686d8042 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c | |||
@@ -490,7 +490,7 @@ static int process_one(char *name) | |||
490 | } | 490 | } |
491 | 491 | ||
492 | int setfiles_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 492 | int setfiles_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
493 | int setfiles_main(int argc, char **argv) | 493 | int setfiles_main(int argc UNUSED_PARAM, char **argv) |
494 | { | 494 | { |
495 | struct stat sb; | 495 | struct stat sb; |
496 | int rc, i = 0; | 496 | int rc, i = 0; |
@@ -549,6 +549,7 @@ int setfiles_main(int argc, char **argv) | |||
549 | IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,) | 549 | IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,) |
550 | &verbose); | 550 | &verbose); |
551 | } | 551 | } |
552 | argv += optind; | ||
552 | 553 | ||
553 | #if ENABLE_FEATURE_SETFILES_CHECK_OPTION | 554 | #if ENABLE_FEATURE_SETFILES_CHECK_OPTION |
554 | if ((applet_name[0] == 's') && (flags & OPT_c)) { | 555 | if ((applet_name[0] == 's') && (flags & OPT_c)) { |
@@ -595,24 +596,20 @@ int setfiles_main(int argc, char **argv) | |||
595 | we can support either checking against the active policy or | 596 | we can support either checking against the active policy or |
596 | checking against a binary policy file. */ | 597 | checking against a binary policy file. */ |
597 | set_matchpathcon_canoncon(&canoncon); | 598 | set_matchpathcon_canoncon(&canoncon); |
598 | if (argc == 1) | 599 | if (!argv[0]) |
599 | bb_show_usage(); | 600 | bb_show_usage(); |
600 | if (stat(argv[optind], &sb) < 0) { | 601 | xstat(argv[0], &sb); |
601 | bb_simple_perror_msg_and_die(argv[optind]); | ||
602 | } | ||
603 | if (!S_ISREG(sb.st_mode)) { | 602 | if (!S_ISREG(sb.st_mode)) { |
604 | bb_error_msg_and_die("spec file %s is not a regular file", argv[optind]); | 603 | bb_error_msg_and_die("spec file %s is not a regular file", argv[0]); |
605 | } | 604 | } |
606 | /* Load the file contexts configuration and check it. */ | 605 | /* Load the file contexts configuration and check it. */ |
607 | rc = matchpathcon_init(argv[optind]); | 606 | rc = matchpathcon_init(argv[0]); |
608 | if (rc < 0) { | 607 | if (rc < 0) { |
609 | bb_simple_perror_msg_and_die(argv[optind]); | 608 | bb_simple_perror_msg_and_die(argv[0]); |
610 | } | 609 | } |
611 | |||
612 | optind++; | ||
613 | |||
614 | if (nerr) | 610 | if (nerr) |
615 | exit(EXIT_FAILURE); | 611 | exit(EXIT_FAILURE); |
612 | argv++; | ||
616 | } | 613 | } |
617 | 614 | ||
618 | if (input_filename) { | 615 | if (input_filename) { |
@@ -628,9 +625,9 @@ int setfiles_main(int argc, char **argv) | |||
628 | if (ENABLE_FEATURE_CLEAN_UP) | 625 | if (ENABLE_FEATURE_CLEAN_UP) |
629 | fclose_if_not_stdin(f); | 626 | fclose_if_not_stdin(f); |
630 | } else { | 627 | } else { |
631 | if (optind >= argc) | 628 | if (!argv[0]) |
632 | bb_show_usage(); | 629 | bb_show_usage(); |
633 | for (i = optind; i < argc; i++) { | 630 | for (i = 0; argv[i]; i++) { |
634 | errors |= process_one(argv[i]); | 631 | errors |= process_one(argv[i]); |
635 | } | 632 | } |
636 | } | 633 | } |