summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-03-28 22:37:19 +0100
committerJim Meyering <meyering@redhat.com>2008-03-28 23:03:27 +0100
commiteb8fa94f2cf030d625c12ad68bb8883de204c196 (patch)
tree8daec3befeac6fdb67abc97c66367f6cc9458dfe /src
parentcdb16829a668fae0aa5e4e292364fc1fbd009ba8 (diff)
downloadcoreutils-eb8fa94f2cf030d625c12ad68bb8883de204c196.tar.xz
mknod, mkfifo: don't segfault when diagnosing invalid SELinux context
Identical to the bug fixed by 72d052896a9092b811961a8f3e6ca5d151a59be5. * 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.
Diffstat (limited to 'src')
-rw-r--r--src/mkfifo.c4
-rw-r--r--src/mknod.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/mkfifo.c b/src/mkfifo.c
index 95ae21459..6abd1bea9 100644
--- a/src/mkfifo.c
+++ b/src/mkfifo.c
@@ -1,5 +1,5 @@
/* mkfifo -- make fifo's (named pipes)
- Copyright (C) 90, 91, 1995-2007 Free Software Foundation, Inc.
+ Copyright (C) 90, 91, 1995-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -116,7 +116,7 @@ main (int argc, char **argv)
if (scontext && setfscreatecon (scontext) < 0)
error (EXIT_FAILURE, errno,
_("failed to set default file creation context to %s"),
- quote (optarg));
+ quote (scontext));
newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (specified_mode)
diff --git a/src/mknod.c b/src/mknod.c
index 3b85ae3fe..8a1718d6b 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -1,5 +1,5 @@
/* mknod -- make special files
- Copyright (C) 90, 91, 1995-2007 Free Software Foundation, Inc.
+ Copyright (C) 90, 91, 1995-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -168,7 +168,7 @@ main (int argc, char **argv)
if (scontext && setfscreatecon (scontext) < 0)
error (EXIT_FAILURE, errno,
_("failed to set default file creation context to %s"),
- quote (optarg));
+ quote (scontext));
/* Only check the first character, to allow mnemonic usage like
`mknod /dev/rst0 character 18 0'. */