Skip to contentSkip to conversation

This patch outputs <<none>> from the matchpathcon command when it gets enoent

PATCH Daniel J Walsh 1 participant 1 message May 18, 2009 SELinux security module

lore
Share & tools
lore
#0 lore raw
utils/matchpathcon.c +7 -3
@@ -22,9 +22,13 @@
 	char *buf;
 	int rc = matchpathcon(path, mode, &buf);
 	if (rc < 0) {
-		fprintf(stderr, "matchpathcon(%s) failed: %s\n", path,
-			strerror(errno));
-		return 1;
+		if (errno == ENOENT) {
+			buf=strdup("<<none>>");
+		} else {
+			fprintf(stderr, "matchpathcon(%s) failed: %s\n", path,
+				strerror(errno));
+			return 1;
+		}
 	}
 	if (header)
 		printf("%s\t%s\n", path, buf);