Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 1 | #include <unistd.h> |
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | #include <selinux/selinux.h> |
| 5 | |
| 6 | int main(int argc, char **argv) |
| 7 | { |
| 8 | char *buf; |
| 9 | int rc, i; |
| 10 | |
| 11 | if (argc < 2) { |
| 12 | fprintf(stderr, "usage: %s path...\n", argv[0]); |
| 13 | exit(1); |
| 14 | } |
| 15 | |
| 16 | for (i = 1; i < argc; i++) { |
| 17 | rc = getfilecon(argv[i], &buf); |
| 18 | if (rc < 0) { |
| 19 | fprintf(stderr, "%s: getfilecon(%s) failed\n", argv[0], |
| 20 | argv[i]); |
| 21 | exit(2); |
| 22 | } |
| 23 | printf("%s\t%s\n", argv[i], buf); |
| 24 | freecon(buf); |
| 25 | } |
Unto Sten | 5d8f44e | 2019-05-10 20:10:37 +0300 | [diff] [blame] | 26 | exit(EXIT_SUCCESS); |
Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 27 | } |