[PATCH 6/8] busybox -- SELinux option support for coreutils: ver3

Bernhard Fischer rep.dot.nop at gmail.com
Thu Mar 8 04:54:50 PST 2007


On Fri, Feb 23, 2007 at 05:48:17PM +0900, Yuichi Nakamura wrote:
>[6/8] busybox-coreutils-06-id.v3.patch
> - -Z option support for id. Security context of process is shown by -Z option.
>
>Signed-off-by:  Yuichi Nakamura <ynakam at hitachisoft.jp>
Index: coreutils/id.c
===================================================================
--- coreutils/id.c      (revision 17961)
+++ coreutils/id.c      (working copy)
...
                } else {
-                       printf("%u\n", (flags & JUST_USER) ? uid : gid);
-               }
+                       if (flags & JUST_USER){
+                               printf("%u\n",uid);
+                       }
+                       if (flags & JUST_GROUP){
+                               printf("%u\n",gid);
+                       }
Why exactly did you need to change this, is it smaller?
+               }
+
+#if ENABLE_SELINUX
+               if(flags & JUST_CONTEXT){

Missing space.

+                       selinux_or_die();
+                       if (argc - optind == 1){
+                               bb_error_msg_and_die("cannot print security cont ext when user specified");
+                       }
+
+                       if (getcon(&scontext)){
+                               bb_error_msg_and_die("can't get process context");

Inconsistent use of "cannot" vs. "can't". The latter is smaller, so..

+                       }
+                       printf("%s\n", scontext);
+               }
+#endif



More information about the busybox mailing list