mknod, mkfifo: don't segfault when diagnosing invalid SELinux context

Identical to the bug fixed by 72d052896a.
* src/mkfifo.c (main): Use "scontext", not NULL optarg in diagnostic.
* src/mknod.c (main): Likewise.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* tests/mkdir/selinux: Test for the above fixes.
* NEWS: Mention the fixes.
This commit is contained in:
Jim Meyering committed 2008-03-28 23:03:27 +01:00
1 parent cdb16829a6
commit eb8fa94f2c
4 files changed
+20 -4

No files matched your search

+15
View File
@@ -19,6 +19,8 @@
if test "$VERBOSE" = yes; then
set -x
mkdir --version
mkfifo --version
mknod --version
fi
. $srcdir/../envvar-check
@@ -32,7 +34,20 @@ mkdir -Z $c dir-arg 2> out && fail=1
cat <<EOF > exp || fail=1
mkdir: failed to set default file creation context to \`$c': Invalid argument
EOF
compare out exp || fail=1
# Until coreutils-6.10.150, mknod and mkfifo had the same problem:
mknod -Z $c b p 2> out && fail=1
cat <<EOF > exp || fail=1
mknod: failed to set default file creation context to \`$c': Invalid argument
EOF
compare out exp || fail=1
mkfifo -Z $c f 2> out && fail=1
cat <<EOF > exp || fail=1
mkfifo: failed to set default file creation context to \`$c': Invalid argument
EOF
compare out exp || fail=1
(exit $fail); exit $fail