Blob Blame History Raw
--- libselinux-2.0.14/src/fgetfilecon.c	2007-04-24 10:36:20.000000000 -0400
+++ libselinux-2.0.14.new/src/fgetfilecon.c	2007-09-13 09:06:28.000000000 -0400
@@ -37,6 +37,11 @@
 		ret = fgetxattr(fd, XATTR_NAME_SELINUX, buf, size - 1);
 	}
       out:
+	if (ret == 0) {
+		/* Re-map empty attribute values to errors. */
+		errno = EOPNOTSUPP;
+		ret = -1;
+	}
 	if (ret < 0)
 		free(buf);
 	else
@@ -51,6 +56,8 @@
 	security_context_t rcontext;
 	int ret;
 
+	*context = NULL;
+
 	ret = fgetfilecon_raw(fd, &rcontext);
 
 	if (ret > 0) {
--- libselinux-2.0.14/src/getfilecon.c	2007-04-24 10:36:21.000000000 -0400
+++ libselinux-2.0.14.new/src/getfilecon.c	2007-09-13 09:06:13.000000000 -0400
@@ -37,6 +37,11 @@
 		ret = getxattr(path, XATTR_NAME_SELINUX, buf, size - 1);
 	}
       out:
+	if (ret == 0) {
+		/* Re-map empty attribute values to errors. */
+		errno = EOPNOTSUPP;
+		ret = -1;
+	}
 	if (ret < 0)
 		free(buf);
 	else
@@ -51,6 +56,8 @@
 	int ret;
 	security_context_t rcontext;
 
+	*context = NULL;
+
 	ret = getfilecon_raw(path, &rcontext);
 
 	if (ret > 0) {
--- libselinux-2.0.14/src/lgetfilecon.c	2007-04-24 10:36:20.000000000 -0400
+++ libselinux-2.0.14.new/src/lgetfilecon.c	2007-09-13 09:06:23.000000000 -0400
@@ -37,6 +37,11 @@
 		ret = lgetxattr(path, XATTR_NAME_SELINUX, buf, size - 1);
 	}
       out:
+	if (ret == 0) {
+		/* Re-map empty attribute values to errors. */
+		errno = EOPNOTSUPP;
+		ret = -1;
+	}
 	if (ret < 0)
 		free(buf);
 	else
@@ -51,6 +56,8 @@
 	int ret;
 	security_context_t rcontext;
 
+	*context = NULL;
+
 	ret = lgetfilecon_raw(path, &rcontext);
 
 	if (ret > 0) {