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
	char *buf;
Chris PeBenito 473ea7
	int rc, i;
Chris PeBenito 473ea7
Chris PeBenito 473ea7
	if (argc < 2) {
Chris PeBenito 473ea7
		fprintf(stderr, "usage:  %s path...\n", argv[0]);
Chris PeBenito 473ea7
		exit(1);
Chris PeBenito 473ea7
	}
Chris PeBenito 473ea7
Chris PeBenito 473ea7
	for (i = 1; i < argc; i++) {
Chris PeBenito 473ea7
		rc = getfilecon(argv[i], &buf;;
Chris PeBenito 473ea7
		if (rc < 0) {
Chris PeBenito 473ea7
			fprintf(stderr, "%s:  getfilecon(%s) failed\n", argv[0], argv[i]);
Chris PeBenito 473ea7
			exit(2);
Chris PeBenito 473ea7
		}
Chris PeBenito 473ea7
		printf("%s\t%s\n", argv[i], buf);
Chris PeBenito 473ea7
		freecon(buf);
Chris PeBenito 473ea7
	}
Chris PeBenito 473ea7
	exit(0);
Chris PeBenito 473ea7
}