MCPcopy Create free account
hub / github.com/coreutils/coreutils / main

Function main

src/mknod.c:95–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95int
96main (int argc, char **argv)
97{
98 char const *specified_mode = NULL;
99 char const *scontext = NULL;
100 struct selabel_handle *set_security_context = NULL;
101
102 initialize_main (&argc, &argv);
103 set_program_name (argv[0]);
104 setlocale (LC_ALL, "");
105 bindtextdomain (PACKAGE, LOCALEDIR);
106 textdomain (PACKAGE);
107
108 atexit (close_stdout);
109
110 int optc;
111 while ((optc = getopt_long (argc, argv, "m:Z", longopts, NULL)) != -1)
112 {
113 switch (optc)
114 {
115 case 'm':
116 specified_mode = optarg;
117 break;
118 case 'Z':
119 if (is_smack_enabled ())
120 {
121 /* We don't yet support -Z to restore context with SMACK. */
122 scontext = optarg;
123 }
124 else if (is_selinux_enabled () > 0)
125 {
126 if (optarg)
127 scontext = optarg;
128 else
129 {
130 set_security_context = selabel_open (SELABEL_CTX_FILE,
131 NULL, 0);
132 if (! set_security_context)
133 error (0, errno, _("warning: ignoring --context"));
134 }
135 }
136 else if (optarg)
137 {
138 error (0, 0,
139 _("warning: ignoring --context; "
140 "it requires an SELinux/SMACK-enabled kernel"));
141 }
142 break;
143 case_GETOPT_HELP_CHAR;
144 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
145 default:
146 usage (EXIT_FAILURE);
147 }
148 }
149
150 mode_t newmode = MODE_RW_UGO;
151 if (specified_mode)
152 {

Callers

nothing calls this directly

Calls 4

is_smack_enabledFunction · 0.85
smack_set_label_for_selfFunction · 0.85
usageFunction · 0.70
defaultconFunction · 0.70

Tested by

no test coverage detected