-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/I+xQACgkQrlYvE4MpobO3YQCbB5DIZ8V6Rm4/vBVvm/RzpaoP lhwAoL3ZZz1pBm6LpLVt6Ob/fNmOV9Ce =6yrt -----END PGP SIGNATURE-----
>From 2ae9b151e509d151c2864512e1c27e8cbad8636f Mon Sep 17 00:00:00 2001 From: Dan Walsh <dwalsh@xxxxxxxxxx> Date: Thu, 24 May 2012 05:52:17 -0400 Subject: [PATCH 69/90] Fix boolean handling of = when setting multiple options --- policycoreutils/setsebool/setsebool.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/policycoreutils/setsebool/setsebool.c b/policycoreutils/setsebool/setsebool.c index e48f3e6..86578f7 100644 --- a/policycoreutils/setsebool/setsebool.c +++ b/policycoreutils/setsebool/setsebool.c @@ -30,7 +30,7 @@ void usage(void) int main(int argc, char **argv) { - size_t rc, start; + size_t rc; int clflag; /* holds codes for command line flags */ if (argc < 2) usage(); @@ -63,30 +63,29 @@ int main(int argc, char **argv) usage(); } - start = argc-optind; /* Check to see which way we are being called. If a '=' is passed, we'll enforce the list syntax. If not we'll enforce the original syntax for backward compatibility. */ - if (strchr(argv[start], '=') == 0) { + if (strchr(argv[optind], '=') == 0) { int len; char *bool_list[1]; - if ((argc - start) != 2) + if ((argc - optind) != 2) usage(); /* Add 1 for the '=' */ - len = strlen(argv[start]) + strlen(argv[start + 1]) + 2; + len = strlen(argv[optind]) + strlen(argv[optind + 1]) + 2; bool_list[0] = (char *)malloc(len); if (bool_list[0] == 0) { fputs("Out of memory - aborting\n", stderr); return 1; } - snprintf(bool_list[0], len, "%s=%s", argv[start], - argv[start + 1]); + snprintf(bool_list[0], len, "%s=%s", argv[optind], + argv[optind + 1]); rc = setbool(bool_list, 0, 1); free(bool_list[0]); } else - rc = setbool(argv, start, argc); + rc = setbool(argv, optind, argc); return rc; } -- 1.7.10.2