Re: PATCH: Fix dir/fs storage pool when SELinux is disabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> 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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]