Chris PeBenito 473ea7
#include <unistd.h>
Chris PeBenito 473ea7
#include <stdio.h>
Chris PeBenito 473ea7
#include <stdlib.h>
Chris PeBenito 473ea7
#include <selinux/selinux.h>
Chris PeBenito 473ea7
Chris PeBenito 473ea7
int main(int argc, char **argv) 
Chris PeBenito 473ea7
{
Chris PeBenito 473ea7
	int rc, i;
Chris PeBenito 473ea7
Chris PeBenito 473ea7
	if (argc < 3) {
Chris PeBenito 473ea7
		fprintf(stderr, "usage:  %s context path...\n", argv[0]);
Chris PeBenito 473ea7
		exit(1);
Chris PeBenito 473ea7
	}
Chris PeBenito 473ea7
Chris PeBenito 473ea7
	for (i = 2; i < argc; i++) {
Chris PeBenito 473ea7
		rc = setfilecon(argv[i], argv[1]);
Chris PeBenito 473ea7
		if (rc < 0) {
Chris PeBenito 473ea7
			fprintf(stderr, "%s:  setfilecon(%s,%s) failed\n", argv[0], argv[i],argv[1]);
Chris PeBenito 473ea7
			exit(2);
Chris PeBenito 473ea7
		}
Chris PeBenito 473ea7
	}
Chris PeBenito 473ea7
	exit(0);
Chris PeBenito 473ea7
}