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

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


On Fri, Feb 23, 2007 at 05:47:53PM +0900, Yuichi Nakamura wrote:
>[3/8] busybox-coreutils-03-mk.v3.patch
> - -Z option support for mkdir, mkfifo, mknod. 
>    By -Z, security context for created file can be set.
>
>Signed-off-by:  Yoshinori Sato <ysato at users.sourceforge.jp>
Index: coreutils/mkdir.c
===================================================================
--- coreutils/mkdir.c   (revision 17961)
+++ coreutils/mkdir.c   (working copy)
@@ -16,6 +16,11 @@
  * conjunction with -m.
  */

+/* Nov 28, 2006      Yoshinori Sato <ysato at users.sourceforge.jp>
+ *
+ * Add -Z (SELinux) support.
+ */
+
Please fix the date and put the description on the same line.

Index: coreutils/libcoreutils/getopt_mk_fifo_nod.c
===================================================================
--- coreutils/libcoreutils/getopt_mk_fifo_nod.c (revision 17961)
+++ coreutils/libcoreutils/getopt_mk_fifo_nod.c (working copy)
@@ -30,11 +30,25 @@
 {
        mode_t mode = 0666;
        char *smode = NULL;
-
-       getopt32(argc, argv, "m:", &smode);
-       if(smode) {
+#if ENABLE_SELINUX
+       security_context_t scontext;
+#endif
+       int opt = 0;
+       opt = getopt32(argc, argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,& scontext));

nah. Setting opt to 0 is superfluous. Smaller if you use the global option_mask32
instead of opt here?

+       if(opt & 1) {

missing space
+       if(opt & 2) {
ditto



More information about the busybox mailing list