mkdir -Z x d: don't segfault when diagnosing invalid context "x" (tiny change)
authorDaniel Dunbar <daniel@zuster.org>
Tue, 25 Mar 2008 23:51:47 +0000 (00:51 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 25 Mar 2008 23:57:29 +0000 (00:57 +0100)
* src/mkdir.c (main): Use "scontext", not NULL optarg in diagnostic.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* NEWS: Mention the bug fix.

NEWS
src/mkdir.c

diff --git a/NEWS b/NEWS
index 43d80ca..5250ed8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ GNU coreutils NEWS                                    -*- outline -*-
   ls no longer segfaults on files in /proc when linked with an older version
   of libselinux.  E.g., ls -l /proc/sys would dereference a NULL pointer.
 
+  "mkdir -Z x dir" no longer segfaults when diagnosing invalid context "x"
+
   mv would mistakenly unlink a destination file before calling rename,
   when the destination had two or more hard links.  It no longer does that.
   [bug introduced in coreutils-5.3.0]
index 3952594..d3d76ad 100644 (file)
@@ -192,7 +192,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));
 
   if (options.make_ancestor_function || specified_mode)
     {