From b85e9bd6431df3c87d03f72204109178bbea8a47 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Tue, 13 Nov 2012 21:17:11 +0100
Status: applied
Subject: [PATCH] libselinux: Use ENOTSUP instead of EOPNOTSUPP for getfilecon
 functions

EOPNOTSUPP means "operation not supoorted on socket", and ENOTSUP means
"not supported", although per POSIX they can be alised to the same
value and on Linux they do, ENOTSUP seems the more correct error code.
In addition these functions are documented as returning ENOTSUP, and
given that they are implemented in means of getxattr(2) which does
return ENOTSUP too, this just consolidates their behaviour.

Signed-off-by: Guillem Jover <guillem@debian.org>
---
 libselinux/src/fgetfilecon.c | 2 +-
 libselinux/src/getfilecon.c  | 2 +-
 libselinux/src/lgetfilecon.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libselinux/src/fgetfilecon.c b/libselinux/src/fgetfilecon.c
index c88d515..3395c9f 100644
--- a/libselinux/src/fgetfilecon.c
+++ b/libselinux/src/fgetfilecon.c
@@ -39,7 +39,7 @@ int fgetfilecon_raw(int fd, security_context_t * context)
       out:
 	if (ret == 0) {
 		/* Re-map empty attribute values to errors. */
-		errno = EOPNOTSUPP;
+		errno = ENOTSUP;
 		ret = -1;
 	}
 	if (ret < 0)
diff --git a/libselinux/src/getfilecon.c b/libselinux/src/getfilecon.c
index 67e4463..eb2ce8a 100644
--- a/libselinux/src/getfilecon.c
+++ b/libselinux/src/getfilecon.c
@@ -39,7 +39,7 @@ int getfilecon_raw(const char *path, security_context_t * context)
       out:
 	if (ret == 0) {
 		/* Re-map empty attribute values to errors. */
-		errno = EOPNOTSUPP;
+		errno = ENOTSUP;
 		ret = -1;
 	}
 	if (ret < 0)
diff --git a/libselinux/src/lgetfilecon.c b/libselinux/src/lgetfilecon.c
index a53f56e..58dc807 100644
--- a/libselinux/src/lgetfilecon.c
+++ b/libselinux/src/lgetfilecon.c
@@ -39,7 +39,7 @@ int lgetfilecon_raw(const char *path, security_context_t * context)
       out:
 	if (ret == 0) {
 		/* Re-map empty attribute values to errors. */
-		errno = EOPNOTSUPP;
+		errno = ENOTSUP;
 		ret = -1;
 	}
 	if (ret < 0)
-- 
1.8.0

