829da0d
diff -urNp coreutils-6.10-orig/src/mkdir.c coreutils-6.10/src/mkdir.c
829da0d
--- coreutils-6.10-orig/src/mkdir.c	2008-03-27 14:42:40.000000000 +0100
829da0d
+++ coreutils-6.10/src/mkdir.c	2008-03-27 14:51:48.000000000 +0100
829da0d
@@ -211,7 +211,7 @@ main (int argc, char **argv)
829da0d
   if (scontext && setfscreatecon (scontext) < 0)
829da0d
     error (EXIT_FAILURE, errno,
829da0d
 	   _("failed to set default file creation context to %s"),
829da0d
-	   quote (optarg));
829da0d
+	   quote (scontext));
829da0d
 
829da0d
   if (options.make_ancestor_function || specified_mode)
829da0d
     {
829da0d
diff -urNp coreutils-6.10-orig/src/mkfifo.c coreutils-6.10/src/mkfifo.c
829da0d
--- coreutils-6.10-orig/src/mkfifo.c	2008-03-29 17:53:27.000000000 +0100
829da0d
+++ coreutils-6.10/src/mkfifo.c	2008-03-29 17:55:44.000000000 +0100
829da0d
@@ -1,5 +1,5 @@
829da0d
 /* mkfifo -- make fifo's (named pipes)
829da0d
-   Copyright (C) 90, 91, 1995-2007 Free Software Foundation, Inc.
829da0d
+   Copyright (C) 90, 91, 1995-2008 Free Software Foundation, Inc.
829da0d
 
829da0d
    This program is free software: you can redistribute it and/or modify
829da0d
    it under the terms of the GNU General Public License as published by
829da0d
@@ -123,7 +123,7 @@ main (int argc, char **argv)
829da0d
   if (scontext && setfscreatecon (scontext) < 0)
829da0d
     error (EXIT_FAILURE, errno,
829da0d
 	   _("failed to set default file creation context to %s"),
829da0d
-	   quote (optarg));
829da0d
+	   quote (scontext));
829da0d
 
829da0d
   newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
829da0d
   if (specified_mode)
829da0d
diff -urNp coreutils-6.10-orig/src/mknod.c coreutils-6.10/src/mknod.c
829da0d
--- coreutils-6.10-orig/src/mknod.c	2008-03-29 17:53:27.000000000 +0100
829da0d
+++ coreutils-6.10/src/mknod.c	2008-03-29 17:55:36.000000000 +0100
829da0d
@@ -175,7 +175,7 @@ main (int argc, char **argv)
829da0d
   if (scontext && setfscreatecon (scontext) < 0)
829da0d
     error (EXIT_FAILURE, errno,
829da0d
 	   _("failed to set default file creation context to %s"),
829da0d
-	   quote (optarg));
829da0d
+	   quote (scontext));
829da0d
 
829da0d
   /* Only check the first character, to allow mnemonic usage like
829da0d
      `mknod /dev/rst0 character 18 0'. */
829da0d
Binární soubory coreutils-6.10-orig/src/.mknod.c.swp a coreutils-6.10/src/.mknod.c.swp jsou různé
829da0d
diff -urNp coreutils-6.10-orig/tests/mkdir/Makefile.am coreutils-6.10/tests/mkdir/Makefile.am
829da0d
--- coreutils-6.10-orig/tests/mkdir/Makefile.am	2007-11-25 14:23:31.000000000 +0100
829da0d
+++ coreutils-6.10/tests/mkdir/Makefile.am	2008-03-29 17:56:51.000000000 +0100
829da0d
@@ -8,6 +8,7 @@ TESTS = \
829da0d
   p-v \
829da0d
   parents \
829da0d
   perm \
829da0d
+  selinux \
829da0d
   special-1 \
829da0d
   t-slash \
829da0d
   writable-under-readonly
829da0d
diff -urNp coreutils-6.10-orig/tests/mkdir/selinux coreutils-6.10/tests/mkdir/selinux
829da0d
--- coreutils-6.10-orig/tests/mkdir/selinux	1970-01-01 01:00:00.000000000 +0100
829da0d
+++ coreutils-6.10/tests/mkdir/selinux	2008-03-29 17:58:25.000000000 +0100
829da0d
@@ -0,0 +1,53 @@
829da0d
+#!/bin/sh
829da0d
+# ensure that an invalid context doesn't cause a segfault
829da0d
+
829da0d
+# Copyright (C) 2008 Free Software Foundation, Inc.
829da0d
+
829da0d
+# This program is free software: you can redistribute it and/or modify
829da0d
+# it under the terms of the GNU General Public License as published by
829da0d
+# the Free Software Foundation, either version 3 of the License, or
829da0d
+# (at your option) any later version.
829da0d
+
829da0d
+# This program is distributed in the hope that it will be useful,
829da0d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
829da0d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
829da0d
+# GNU General Public License for more details.
829da0d
+
829da0d
+# You should have received a copy of the GNU General Public License
829da0d
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
829da0d
+
829da0d
+if test "$VERBOSE" = yes; then
829da0d
+  set -x
829da0d
+  mkdir --version
829da0d
+  mkfifo --version
829da0d
+  mknod --version
829da0d
+fi
829da0d
+
829da0d
+. $srcdir/../envvar-check
829da0d
+. $srcdir/../lang-default
829da0d
+. $srcdir/../test-lib.sh
829da0d
+
829da0d
+c=invalid-selinux-context
829da0d
+
829da0d
+fail=0
829da0d
+mkdir -Z $c dir-arg 2> out && fail=1
829da0d
+cat <<EOF > exp || fail=1
829da0d
+mkdir: failed to set default file creation context to \`$c': Invalid argument
829da0d
+EOF
829da0d
+compare out exp || fail=1
829da0d
+
829da0d
+# Until coreutils-6.10.150, mknod and mkfifo had the same problem:
829da0d
+
829da0d
+mknod -Z $c b p 2> out && fail=1
829da0d
+cat <<EOF > exp || fail=1
829da0d
+mknod: failed to set default file creation context to \`$c': Invalid argument
829da0d
+EOF
829da0d
+compare out exp || fail=1
829da0d
+
829da0d
+mkfifo -Z $c f 2> out && fail=1
829da0d
+cat <<EOF > exp || fail=1
829da0d
+mkfifo: failed to set default file creation context to \`$c': Invalid argument
829da0d
+EOF
829da0d
+compare out exp || fail=1
829da0d
+
829da0d
+(exit $fail); exit $fail