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

+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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'. */