[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: RE: [PATCH 6/8] busybox -- libselinux utilities applets
From: "Peter Kjellerstedt" <peter.kjellerstedt () axis ! com>
Date: 2007-01-29 9:11:15
Message-ID: 50BF37ECE4954A4BA18C08D0C2CF88CB01A44358 () exmail1 ! se ! axis ! com
[Download RAW message or body]
> -----Original Message-----
> From: busybox-bounces@busybox.net
> [mailto:busybox-bounces@busybox.net] On Behalf Of Denis Vlasenko
> Sent: Saturday, January 27, 2007 00:45
> To: busybox@busybox.net
> Cc: russell@coker.com.au; rob@landley.net;
> selinux@tycho.nsa.gov; busybox@kaigai.gr.jp
> Subject: Re: [PATCH 6/8] busybox -- libselinux utilities applets
>
> On Thursday 25 January 2007 15:44, KaiGai Kohei wrote:
> > [6/8] busybox-libselinux-06-togglesebool.patch
> > togglesebool - flip the current value of a SELinux
> > boolean variable.
> >
> > Signed-off-by: Hiroshi Shinji <shiroshi@my.email.ne.jp>
> > Signed-off-by: KaiGai Kohei <kaigai@kaigai.gr.jp>
> >
> > --
> > KaiGai Kohei <kaigai@kaigai.gr.jp>
>
>
> Index: selinux/togglesebool.c
> ===================================================================
> --- selinux/togglesebool.c (revision 0)
> +++ selinux/togglesebool.c (revision 0)
> @@ -0,0 +1,106 @@
[snip]
> + for (i = 1; i < argc; i++) {
> + printf("%s: ", argv[i]);
> + rc = security_get_boolean_active(argv[i]);
> + switch (rc) {
> + case 1:
> + if (security_set_boolean(argv[i], 0) >= 0) {
> + printf("inactive\n");
> + commit++;
> + } else {
> + printf("%s - rolling back all changes\n",
> + strerror(errno));
> + rollback(i, argv);
> + }
>
> By reversing the if() [i.e.: security_set_boolean(argv[i], 0) < 0]
> and swapping then/else blocks, and noticing that rollback()
> never returns, you don't need else block:
> if (security_set_boolean(argv[i], 0) < 0) {
> printf("%s - rolling back all changes\n",
> strerror(errno));
> rollback(i, argv);
But please make sure to add a comment stating the fact that
rollback() will never return.
//Peter
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic