aboutsummaryrefslogtreecommitdiffstats
path: root/src/mknod.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mknod.c')
-rw-r--r--src/mknod.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/mknod.c b/src/mknod.c
index c8cc61166..576d1b060 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -23,8 +23,6 @@
#include <selinux/label.h>
#include "system.h"
-#include "die.h"
-#include "error.h"
#include "modechange.h"
#include "quote.h"
#include "selinux.h"
@@ -153,14 +151,14 @@ main (int argc, char **argv)
mode_t umask_value;
struct mode_change *change = mode_compile (specified_mode);
if (!change)
- die (EXIT_FAILURE, 0, _("invalid mode"));
+ error (EXIT_FAILURE, 0, _("invalid mode"));
umask_value = umask (0);
umask (umask_value);
newmode = mode_adjust (newmode, false, umask_value, change, nullptr);
free (change);
if (newmode & ~S_IRWXUGO)
- die (EXIT_FAILURE, 0,
- _("mode must specify only file permission bits"));
+ error (EXIT_FAILURE, 0,
+ _("mode must specify only file permission bits"));
}
/* If the number of arguments is 0 or 1,
@@ -201,9 +199,9 @@ main (int argc, char **argv)
ret = setfscreatecon (scontext);
if (ret < 0)
- die (EXIT_FAILURE, errno,
- _("failed to set default file creation context to %s"),
- quote (scontext));
+ error (EXIT_FAILURE, errno,
+ _("failed to set default file creation context to %s"),
+ quote (scontext));
}
/* Only check the first character, to allow mnemonic usage like
@@ -213,7 +211,7 @@ main (int argc, char **argv)
{
case 'b': /* 'block' or 'buffered' */
#ifndef S_IFBLK
- die (EXIT_FAILURE, 0, _("block special files not supported"));
+ error (EXIT_FAILURE, 0, _("block special files not supported"));
#else
node_type = S_IFBLK;
#endif
@@ -222,7 +220,7 @@ main (int argc, char **argv)
case 'c': /* 'character' */
case 'u': /* 'unbuffered' */
#ifndef S_IFCHR
- die (EXIT_FAILURE, 0, _("character special files not supported"));
+ error (EXIT_FAILURE, 0, _("character special files not supported"));
#else
node_type = S_IFCHR;
#endif
@@ -237,26 +235,26 @@ main (int argc, char **argv)
if (xstrtoumax (s_major, nullptr, 0, &i_major, "") != LONGINT_OK
|| i_major != (major_t) i_major)
- die (EXIT_FAILURE, 0,
- _("invalid major device number %s"), quote (s_major));
+ error (EXIT_FAILURE, 0,
+ _("invalid major device number %s"), quote (s_major));
if (xstrtoumax (s_minor, nullptr, 0, &i_minor, "") != LONGINT_OK
|| i_minor != (minor_t) i_minor)
- die (EXIT_FAILURE, 0,
- _("invalid minor device number %s"), quote (s_minor));
+ error (EXIT_FAILURE, 0,
+ _("invalid minor device number %s"), quote (s_minor));
device = makedev (i_major, i_minor);
#ifdef NODEV
if (device == NODEV)
- die (EXIT_FAILURE, 0, _("invalid device %s %s"),
- s_major, s_minor);
+ error (EXIT_FAILURE, 0, _("invalid device %s %s"),
+ s_major, s_minor);
#endif
if (set_security_context)
defaultcon (set_security_context, argv[optind], node_type);
if (mknod (argv[optind], newmode | node_type, device) != 0)
- die (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
+ error (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
}
break;
@@ -264,7 +262,7 @@ main (int argc, char **argv)
if (set_security_context)
defaultcon (set_security_context, argv[optind], S_IFIFO);
if (mkfifo (argv[optind], newmode) != 0)
- die (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
+ error (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
break;
default:
@@ -273,8 +271,8 @@ main (int argc, char **argv)
}
if (specified_mode && lchmod (argv[optind], newmode) != 0)
- die (EXIT_FAILURE, errno, _("cannot set permissions of %s"),
- quoteaf (argv[optind]));
+ error (EXIT_FAILURE, errno, _("cannot set permissions of %s"),
+ quoteaf (argv[optind]));
return EXIT_SUCCESS;
}