| 142 | } |
| 143 | |
| 144 | int |
| 145 | main (int argc, char **argv) |
| 146 | { |
| 147 | int optc; |
| 148 | int selinux_enabled = (is_selinux_enabled () > 0); |
| 149 | bool smack_enabled = is_smack_enabled (); |
| 150 | |
| 151 | initialize_main (&argc, &argv); |
| 152 | set_program_name (argv[0]); |
| 153 | setlocale (LC_ALL, ""); |
| 154 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 155 | textdomain (PACKAGE); |
| 156 | |
| 157 | atexit (close_stdout); |
| 158 | |
| 159 | while ((optc = getopt_long (argc, argv, "agnruzGZ", longopts, NULL)) != -1) |
| 160 | { |
| 161 | switch (optc) |
| 162 | { |
| 163 | case 'a': |
| 164 | /* Ignore -a, for compatibility with SVR4. */ |
| 165 | break; |
| 166 | |
| 167 | case 'Z': |
| 168 | /* politely decline if we're not on a SELinux/SMACK-enabled kernel. */ |
| 169 | #ifdef HAVE_SMACK |
| 170 | if (!selinux_enabled && !smack_enabled) |
| 171 | error (EXIT_FAILURE, 0, |
| 172 | _("--context (-Z) works only on " |
| 173 | "an SELinux/SMACK-enabled kernel")); |
| 174 | #else |
| 175 | if (!selinux_enabled) |
| 176 | error (EXIT_FAILURE, 0, |
| 177 | _("--context (-Z) works only on an SELinux-enabled kernel")); |
| 178 | #endif |
| 179 | just_context = true; |
| 180 | break; |
| 181 | |
| 182 | case 'g': |
| 183 | just_group = true; |
| 184 | break; |
| 185 | case 'n': |
| 186 | use_name = true; |
| 187 | break; |
| 188 | case 'r': |
| 189 | use_real = true; |
| 190 | break; |
| 191 | case 'u': |
| 192 | just_user = true; |
| 193 | break; |
| 194 | case 'z': |
| 195 | opt_zero = true; |
| 196 | break; |
| 197 | case 'G': |
| 198 | just_group_list = true; |
| 199 | break; |
| 200 | case_GETOPT_HELP_CHAR; |
| 201 | case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); |
nothing calls this directly
no test coverage detected