[Libvir] PATCH: Fix dir/fs storage pool when SELinux is disabled

Jim Meyering jim at meyering.net
Mon Mar 17 16:36:49 UTC 2008


"Daniel P. Berrange" <berrange at redhat.com> wrote:
> When SELinux is disabled  fgetfilecon() may well return -1, if a file has no
> extended attribute with security context data. This causes the storage pool
> to skip that file. The fix is to check whether errno is ENODATA and treat
> that as an expected error case & ignore it.

Hi Dan,

That code should handle ENOTSUP as well as ENODATA.
Here's the change:

	Treat ENOTSUP like ENODATA, after failed fgetfilecon.
	* src/storage_backend.c (virStorageBackendUpdateVolInfoFD): Treat a
	failed fgetfilecon with errno == ENOTSUP the same as for ENODATA.

diff --git a/src/storage_backend.c b/src/storage_backend.c
index 9702de3..4a58cb6 100644
--- a/src/storage_backend.c
+++ b/src/storage_backend.c
@@ -240,7 +240,7 @@ virStorageBackendUpdateVolInfoFD(virConnectPtr conn,

 #if HAVE_SELINUX
     if (fgetfilecon(fd, &filecon) == -1) {
-        if (errno != ENODATA) {
+        if (errno != ENODATA && errno != ENOTSUP) {
             virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
                                   _("cannot get file context of %s: %s"),
                                   vol->target.path, strerror(errno));
--
1.5.4.4.482.g16f99




More information about the libvir-list mailing list