1 #include <unistd.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <selinux/selinux.h> 5 main(int argc,char ** argv)6int main(int argc, char **argv) 7 { 8 int rc, i; 9 10 if (argc < 3) { 11 fprintf(stderr, "usage: %s context path...\n", argv[0]); 12 exit(1); 13 } 14 15 for (i = 2; i < argc; i++) { 16 rc = setfilecon(argv[i], argv[1]); 17 if (rc < 0) { 18 fprintf(stderr, "%s: setfilecon(%s,%s) failed\n", 19 argv[0], argv[i], argv[1]); 20 exit(2); 21 } 22 } 23 exit(EXIT_SUCCESS); 24 } 25