| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/mknod.c |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /* mknod -- make special files | - | ||||||||||||
| 2 | Copyright (C) 1990-2018 Free Software Foundation, Inc. | - | ||||||||||||
| 3 | - | |||||||||||||
| 4 | This program is free software: you can redistribute it and/or modify | - | ||||||||||||
| 5 | it under the terms of the GNU General Public License as published by | - | ||||||||||||
| 6 | the Free Software Foundation, either version 3 of the License, or | - | ||||||||||||
| 7 | (at your option) any later version. | - | ||||||||||||
| 8 | - | |||||||||||||
| 9 | This program is distributed in the hope that it will be useful, | - | ||||||||||||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | ||||||||||||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | ||||||||||||
| 12 | GNU General Public License for more details. | - | ||||||||||||
| 13 | - | |||||||||||||
| 14 | You should have received a copy of the GNU General Public License | - | ||||||||||||
| 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | /* Written by David MacKenzie <djm@ai.mit.edu> */ | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | #include <config.h> | - | ||||||||||||
| 20 | #include <stdio.h> | - | ||||||||||||
| 21 | #include <getopt.h> | - | ||||||||||||
| 22 | #include <sys/types.h> | - | ||||||||||||
| 23 | #include <selinux/selinux.h> | - | ||||||||||||
| 24 | - | |||||||||||||
| 25 | #include "system.h" | - | ||||||||||||
| 26 | #include "die.h" | - | ||||||||||||
| 27 | #include "error.h" | - | ||||||||||||
| 28 | #include "modechange.h" | - | ||||||||||||
| 29 | #include "quote.h" | - | ||||||||||||
| 30 | #include "selinux.h" | - | ||||||||||||
| 31 | #include "smack.h" | - | ||||||||||||
| 32 | #include "xstrtol.h" | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | /* The official name of this program (e.g., no 'g' prefix). */ | - | ||||||||||||
| 35 | #define PROGRAM_NAME "mknod" | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | #define AUTHORS proper_name ("David MacKenzie") | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | static struct option const longopts[] = | - | ||||||||||||
| 40 | { | - | ||||||||||||
| 41 | {GETOPT_SELINUX_CONTEXT_OPTION_DECL}, | - | ||||||||||||
| 42 | {"mode", required_argument, NULL, 'm'}, | - | ||||||||||||
| 43 | {GETOPT_HELP_OPTION_DECL}, | - | ||||||||||||
| 44 | {GETOPT_VERSION_OPTION_DECL}, | - | ||||||||||||
| 45 | {NULL, 0, NULL, 0} | - | ||||||||||||
| 46 | }; | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | void | - | ||||||||||||
| 49 | usage (int status) | - | ||||||||||||
| 50 | { | - | ||||||||||||
| 51 | if (status != EXIT_SUCCESS)
| 1-2 | ||||||||||||
| 52 | emit_try_help (); executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 53 | else | - | ||||||||||||
| 54 | { | - | ||||||||||||
| 55 | printf (_("Usage: %s [OPTION]... NAME TYPE [MAJOR MINOR]\n"), | - | ||||||||||||
| 56 | program_name); | - | ||||||||||||
| 57 | fputs (_("\ | - | ||||||||||||
| 58 | Create the special file NAME of the given TYPE.\n\ | - | ||||||||||||
| 59 | "), stdout); | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | emit_mandatory_arg_note (); | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | fputs (_("\ | - | ||||||||||||
| 64 | -m, --mode=MODE set file permission bits to MODE, not a=rw - umask\n\ | - | ||||||||||||
| 65 | "), stdout); | - | ||||||||||||
| 66 | fputs (_("\ | - | ||||||||||||
| 67 | -Z set the SELinux security context to default type\n\ | - | ||||||||||||
| 68 | --context[=CTX] like -Z, or if CTX is specified then set the SELinux\n\ | - | ||||||||||||
| 69 | or SMACK security context to CTX\n\ | - | ||||||||||||
| 70 | "), stdout); | - | ||||||||||||
| 71 | fputs (HELP_OPTION_DESCRIPTION, stdout); | - | ||||||||||||
| 72 | fputs (VERSION_OPTION_DESCRIPTION, stdout); | - | ||||||||||||
| 73 | fputs (_("\ | - | ||||||||||||
| 74 | \n\ | - | ||||||||||||
| 75 | Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they\n\ | - | ||||||||||||
| 76 | must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X,\n\ | - | ||||||||||||
| 77 | it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal;\n\ | - | ||||||||||||
| 78 | otherwise, as decimal. TYPE may be:\n\ | - | ||||||||||||
| 79 | "), stdout); | - | ||||||||||||
| 80 | fputs (_("\ | - | ||||||||||||
| 81 | \n\ | - | ||||||||||||
| 82 | b create a block (buffered) special file\n\ | - | ||||||||||||
| 83 | c, u create a character (unbuffered) special file\n\ | - | ||||||||||||
| 84 | p create a FIFO\n\ | - | ||||||||||||
| 85 | "), stdout); | - | ||||||||||||
| 86 | printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); | - | ||||||||||||
| 87 | emit_ancillary_info (PROGRAM_NAME); | - | ||||||||||||
| 88 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 89 | exit (status); executed 3 times by 1 test: exit (status);Executed by:
| 3 | ||||||||||||
| 90 | } | - | ||||||||||||
| 91 | - | |||||||||||||
| 92 | int | - | ||||||||||||
| 93 | main (int argc, char **argv) | - | ||||||||||||
| 94 | { | - | ||||||||||||
| 95 | mode_t newmode; | - | ||||||||||||
| 96 | char const *specified_mode = NULL; | - | ||||||||||||
| 97 | int optc; | - | ||||||||||||
| 98 | size_t expected_operands; | - | ||||||||||||
| 99 | mode_t node_type; | - | ||||||||||||
| 100 | char const *scontext = NULL; | - | ||||||||||||
| 101 | bool set_security_context = false; | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | initialize_main (&argc, &argv); | - | ||||||||||||
| 104 | set_program_name (argv[0]); | - | ||||||||||||
| 105 | setlocale (LC_ALL, ""); | - | ||||||||||||
| 106 | bindtextdomain (PACKAGE, LOCALEDIR); | - | ||||||||||||
| 107 | textdomain (PACKAGE); | - | ||||||||||||
| 108 | - | |||||||||||||
| 109 | atexit (close_stdout); | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | while ((optc = getopt_long (argc, argv, "m:Z", longopts, NULL)) != -1)
| 0-8 | ||||||||||||
| 112 | { | - | ||||||||||||
| 113 | switch (optc) | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | case 'm': never executed: case 'm': | 0 | ||||||||||||
| 116 | specified_mode = optarg; | - | ||||||||||||
| 117 | break; never executed: break; | 0 | ||||||||||||
| 118 | case 'Z': never executed: case 'Z': | 0 | ||||||||||||
| 119 | if (is_smack_enabled ())
| 0 | ||||||||||||
| 120 | { | - | ||||||||||||
| 121 | /* We don't yet support -Z to restore context with SMACK. */ | - | ||||||||||||
| 122 | scontext = optarg; | - | ||||||||||||
| 123 | } never executed: end of block | 0 | ||||||||||||
| 124 | else if (is_selinux_enabled () > 0)
| 0 | ||||||||||||
| 125 | { | - | ||||||||||||
| 126 | if (optarg)
| 0 | ||||||||||||
| 127 | scontext = optarg; never executed: scontext = optarg; | 0 | ||||||||||||
| 128 | else | - | ||||||||||||
| 129 | set_security_context = true; never executed: set_security_context = 1 ; | 0 | ||||||||||||
| 130 | } | - | ||||||||||||
| 131 | else if (optarg)
| 0 | ||||||||||||
| 132 | { | - | ||||||||||||
| 133 | error (0, 0, | - | ||||||||||||
| 134 | _("warning: ignoring --context; " | - | ||||||||||||
| 135 | "it requires an SELinux/SMACK-enabled kernel")); | - | ||||||||||||
| 136 | } never executed: end of block | 0 | ||||||||||||
| 137 | break; never executed: break; | 0 | ||||||||||||
| 138 | case_GETOPT_HELP_CHAR; never executed: break;executed 2 times by 1 test: case GETOPT_HELP_CHAR:Executed by:
| 0-2 | ||||||||||||
| 139 | case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); executed 5 times by 1 test: exit ( 0 );Executed by:
never executed: break;executed 5 times by 1 test: case GETOPT_VERSION_CHAR:Executed by:
| 0-5 | ||||||||||||
| 140 | default: executed 1 time by 1 test: default:Executed by:
| 1 | ||||||||||||
| 141 | usage (EXIT_FAILURE); | - | ||||||||||||
| 142 | } never executed: end of block | 0 | ||||||||||||
| 143 | } | - | ||||||||||||
| 144 | - | |||||||||||||
| 145 | newmode = MODE_RW_UGO; | - | ||||||||||||
| 146 | if (specified_mode)
| 0 | ||||||||||||
| 147 | { | - | ||||||||||||
| 148 | mode_t umask_value; | - | ||||||||||||
| 149 | struct mode_change *change = mode_compile (specified_mode); | - | ||||||||||||
| 150 | if (!change)
| 0 | ||||||||||||
| 151 | die (EXIT_FAILURE, 0, _("invalid mode")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid mode\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid mode" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid mode" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 | ||||||||||||
| 152 | umask_value = umask (0); | - | ||||||||||||
| 153 | umask (umask_value); | - | ||||||||||||
| 154 | newmode = mode_adjust (newmode, false, umask_value, change, NULL); | - | ||||||||||||
| 155 | free (change); | - | ||||||||||||
| 156 | if (newmode & ~S_IRWXUGO)
| 0 | ||||||||||||
| 157 | die (EXIT_FAILURE, 0, never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"mode must specify only file permission bits\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "mode must specify only file permission bits" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "mode must specify only file permission bits" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 158 | _("mode must specify only file permission bits")); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"mode must specify only file permission bits\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "mode must specify only file permission bits" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "mode must specify only file permission bits" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 159 | } never executed: end of block | 0 | ||||||||||||
| 160 | - | |||||||||||||
| 161 | /* If the number of arguments is 0 or 1, | - | ||||||||||||
| 162 | or (if it's 2 or more and the second one starts with 'p'), then there | - | ||||||||||||
| 163 | must be exactly two operands. Otherwise, there must be four. */ | - | ||||||||||||
| 164 | expected_operands = (argc <= optind
| 0 | ||||||||||||
| 165 | || (optind + 1 < argc && argv[optind + 1][0] == 'p')
| 0 | ||||||||||||
| 166 | ? 2 : 4); | - | ||||||||||||
| 167 | - | |||||||||||||
| 168 | if (argc - optind < expected_operands)
| 0 | ||||||||||||
| 169 | { | - | ||||||||||||
| 170 | if (argc <= optind)
| 0 | ||||||||||||
| 171 | error (0, 0, _("missing operand")); never executed: error (0, 0, dcgettext (((void *)0), "missing operand" , 5) ); | 0 | ||||||||||||
| 172 | else | - | ||||||||||||
| 173 | error (0, 0, _("missing operand after %s"), quote (argv[argc - 1])); never executed: error (0, 0, dcgettext (((void *)0), "missing operand after %s" , 5) , quote (argv[argc - 1])); | 0 | ||||||||||||
| 174 | if (expected_operands == 4 && argc - optind == 2)
| 0 | ||||||||||||
| 175 | fprintf (stderr, "%s\n", never executed: fprintf ( stderr , "%s\n", dcgettext (((void *)0), "Special files require major and minor device numbers." , 5) ); | 0 | ||||||||||||
| 176 | _("Special files require major and minor device numbers.")); never executed: fprintf ( stderr , "%s\n", dcgettext (((void *)0), "Special files require major and minor device numbers." , 5) ); | 0 | ||||||||||||
| 177 | usage (EXIT_FAILURE); | - | ||||||||||||
| 178 | } never executed: end of block | 0 | ||||||||||||
| 179 | - | |||||||||||||
| 180 | if (expected_operands < argc - optind)
| 0 | ||||||||||||
| 181 | { | - | ||||||||||||
| 182 | error (0, 0, _("extra operand %s"), | - | ||||||||||||
| 183 | quote (argv[optind + expected_operands])); | - | ||||||||||||
| 184 | if (expected_operands == 2 && argc - optind == 4)
| 0 | ||||||||||||
| 185 | fprintf (stderr, "%s\n", never executed: fprintf ( stderr , "%s\n", dcgettext (((void *)0), "Fifos do not have major and minor device numbers." , 5) ); | 0 | ||||||||||||
| 186 | _("Fifos do not have major and minor device numbers.")); never executed: fprintf ( stderr , "%s\n", dcgettext (((void *)0), "Fifos do not have major and minor device numbers." , 5) ); | 0 | ||||||||||||
| 187 | usage (EXIT_FAILURE); | - | ||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||
| 189 | - | |||||||||||||
| 190 | if (scontext)
| 0 | ||||||||||||
| 191 | { | - | ||||||||||||
| 192 | int ret = 0; | - | ||||||||||||
| 193 | if (is_smack_enabled ())
| 0 | ||||||||||||
| 194 | ret = smack_set_label_for_self (scontext); never executed: ret = smack_set_label_for_self (scontext); | 0 | ||||||||||||
| 195 | else | - | ||||||||||||
| 196 | ret = setfscreatecon (se_const (scontext)); never executed: ret = setfscreatecon (se_const (scontext)); | 0 | ||||||||||||
| 197 | - | |||||||||||||
| 198 | if (ret < 0)
| 0 | ||||||||||||
| 199 | die (EXIT_FAILURE, errno, never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to set default file creation context to %s\", 5), quote (scontext)), assume (false))" ")"); int _gl_dummy; })) ? ((erro... (scontext)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (scontext)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 200 | _("failed to set default file creation context to %s"), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to set default file creation context to %s\", 5), quote (scontext)), assume (false))" ")"); int _gl_dummy; })) ? ((erro... (scontext)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (scontext)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 201 | quote (scontext)); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to set default file creation context to %s\", 5), quote (scontext)), assume (false))" ")"); int _gl_dummy; })) ? ((erro... (scontext)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (scontext)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 202 | } never executed: end of block | 0 | ||||||||||||
| 203 | - | |||||||||||||
| 204 | /* Only check the first character, to allow mnemonic usage like | - | ||||||||||||
| 205 | 'mknod /dev/rst0 character 18 0'. */ | - | ||||||||||||
| 206 | - | |||||||||||||
| 207 | switch (argv[optind + 1][0]) | - | ||||||||||||
| 208 | { | - | ||||||||||||
| 209 | case 'b': /* 'block' or 'buffered' */ never executed: case 'b': | 0 | ||||||||||||
| 210 | #ifndef S_IFBLK | - | ||||||||||||
| 211 | die (EXIT_FAILURE, 0, _("block special files not supported")); | - | ||||||||||||
| 212 | #else | - | ||||||||||||
| 213 | node_type = S_IFBLK; | - | ||||||||||||
| 214 | #endif | - | ||||||||||||
| 215 | goto block_or_character; never executed: goto block_or_character; | 0 | ||||||||||||
| 216 | - | |||||||||||||
| 217 | case 'c': /* 'character' */ never executed: case 'c': | 0 | ||||||||||||
| 218 | case 'u': /* 'unbuffered' */ never executed: case 'u': | 0 | ||||||||||||
| 219 | #ifndef S_IFCHR | - | ||||||||||||
| 220 | die (EXIT_FAILURE, 0, _("character special files not supported")); | - | ||||||||||||
| 221 | #else | - | ||||||||||||
| 222 | node_type = S_IFCHR; | - | ||||||||||||
| 223 | #endif | - | ||||||||||||
| 224 | goto block_or_character; never executed: goto block_or_character; | 0 | ||||||||||||
| 225 | - | |||||||||||||
| 226 | block_or_character: | - | ||||||||||||
| 227 | { | - | ||||||||||||
| 228 | char const *s_major = argv[optind + 2]; | - | ||||||||||||
| 229 | char const *s_minor = argv[optind + 3]; | - | ||||||||||||
| 230 | uintmax_t i_major, i_minor; | - | ||||||||||||
| 231 | dev_t device; | - | ||||||||||||
| 232 | - | |||||||||||||
| 233 | if (xstrtoumax (s_major, NULL, 0, &i_major, NULL) != LONGINT_OK
| 0 | ||||||||||||
| 234 | || i_major != (major_t) i_major)
| 0 | ||||||||||||
| 235 | die (EXIT_FAILURE, 0, never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid major device number %s\", 5), quote (s_major)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid major device number %s" , 5) , quote (s_major)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid major device number %s" , 5) , quote (s_major)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 236 | _("invalid major device number %s"), quote (s_major)); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid major device number %s\", 5), quote (s_major)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid major device number %s" , 5) , quote (s_major)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid major device number %s" , 5) , quote (s_major)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 237 | - | |||||||||||||
| 238 | if (xstrtoumax (s_minor, NULL, 0, &i_minor, NULL) != LONGINT_OK
| 0 | ||||||||||||
| 239 | || i_minor != (minor_t) i_minor)
| 0 | ||||||||||||
| 240 | die (EXIT_FAILURE, 0, never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid minor device number %s\", 5), quote (s_minor)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid minor device number %s" , 5) , quote (s_minor)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid minor device number %s" , 5) , quote (s_minor)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 241 | _("invalid minor device number %s"), quote (s_minor)); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid minor device number %s\", 5), quote (s_minor)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid minor device number %s" , 5) , quote (s_minor)), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid minor device number %s" , 5) , quote (s_minor)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 242 | - | |||||||||||||
| 243 | device = makedev (i_major, i_minor); | - | ||||||||||||
| 244 | #ifdef NODEV | - | ||||||||||||
| 245 | if (device == NODEV)
| 0 | ||||||||||||
| 246 | die (EXIT_FAILURE, 0, _("invalid device %s %s"), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid device %s %s\", 5), s_major, s_minor), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid device %s %s" , 5) , s_major, s_minor), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid device %s %s" , 5) , s_major, s_minor), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 247 | s_major, s_minor); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"invalid device %s %s\", 5), s_major, s_minor), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "invalid device %s %s" , 5) , s_major, s_minor), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "invalid device %s %s" , 5) , s_major, s_minor), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 248 | #endif | - | ||||||||||||
| 249 | - | |||||||||||||
| 250 | if (set_security_context)
| 0 | ||||||||||||
| 251 | defaultcon (argv[optind], node_type); never executed: defaultcon (argv[optind], node_type); | 0 | ||||||||||||
| 252 | - | |||||||||||||
| 253 | if (mknod (argv[optind], newmode | node_type, device) != 0)
| 0 | ||||||||||||
| 254 | die (EXIT_FAILURE, errno, "%s", quotef (argv[optind])); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, argv[optind])), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_locat...l_escape_quoting_style, argv[optind])), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, argv[optind])), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 | ||||||||||||
| 255 | } | - | ||||||||||||
| 256 | break; never executed: break; | 0 | ||||||||||||
| 257 | - | |||||||||||||
| 258 | case 'p': /* 'pipe' */ never executed: case 'p': | 0 | ||||||||||||
| 259 | if (set_security_context)
| 0 | ||||||||||||
| 260 | defaultcon (argv[optind], S_IFIFO); never executed: defaultcon (argv[optind], 0010000 ); | 0 | ||||||||||||
| 261 | if (mkfifo (argv[optind], newmode) != 0)
| 0 | ||||||||||||
| 262 | die (EXIT_FAILURE, errno, "%s", quotef (argv[optind])); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, argv[optind])), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_locat...l_escape_quoting_style, argv[optind])), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, argv[optind])), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 | ||||||||||||
| 263 | break; never executed: break; | 0 | ||||||||||||
| 264 | - | |||||||||||||
| 265 | default: never executed: default: | 0 | ||||||||||||
| 266 | error (0, 0, _("invalid device type %s"), quote (argv[optind + 1])); | - | ||||||||||||
| 267 | usage (EXIT_FAILURE); | - | ||||||||||||
| 268 | } never executed: end of block | 0 | ||||||||||||
| 269 | - | |||||||||||||
| 270 | if (specified_mode && lchmod (argv[optind], newmode) != 0)
| 0 | ||||||||||||
| 271 | die (EXIT_FAILURE, errno, _("cannot set permissions of %s"), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot set permissions of %s\", 5), quotearg_style (shell_escape_always_quoting_style, argv[optind])), assume (false))" ")"); ...d) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot set permissions of %s" , 5) , quotearg_style (shell_escape_always_quoting_style, argv[optind])), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 272 | quoteaf (argv[optind])); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"cannot set permissions of %s\", 5), quotearg_style (shell_escape_always_quoting_style, argv[optind])), assume (false))" ")"); ...d) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "cannot set permissions of %s" , 5) , quotearg_style (shell_escape_always_quoting_style, argv[optind])), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||
| 273 | - | |||||||||||||
| 274 | return EXIT_SUCCESS; never executed: return 0 ; | 0 | ||||||||||||
| 275 | } | - | ||||||||||||
| Source code | Switch to Preprocessed file |