]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Cope with missing selinux attribute
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 17 Mar 2008 15:09:38 +0000 (15:09 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 17 Mar 2008 15:09:38 +0000 (15:09 +0000)
ChangeLog
src/storage_backend.c

index 5fadb1f0445ef09031900d89f402f3306b0a7a9c..5b92497f4728dcd4af87d0a3b7cc8a39461e46af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 17 11:09:22 EDT 2008 Daniel P. Berrange <berrange@redhat.com>
+
+       * src/storage_backend.c: Cope with missing SELinux context
+       data by ignoring the error
+
 Mon Mar 17 11:46:09 CET 2008 Daniel Veillard <veillard@redhat.com>
 
        * src/libvirt.c docs/libvirt-*.xml docs/html/libvirt-libvirt.html:
index da0f34a1fa454027a878fe394dcb990f68bb2829..9702de33921cc3fd7634ba89623f80d52dfe7c53 100644 (file)
@@ -240,17 +240,22 @@ virStorageBackendUpdateVolInfoFD(virConnectPtr conn,
 
 #if HAVE_SELINUX
     if (fgetfilecon(fd, &filecon) == -1) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
-                              _("cannot get file context of %s: %s"),
-                              vol->target.path, strerror(errno));
-        return -1;
-    }
-    vol->target.perms.label = strdup(filecon);
-    if (vol->target.perms.label == NULL) {
-        virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("context"));
-        return -1;
+        if (errno != ENODATA) {
+            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                                  _("cannot get file context of %s: %s"),
+                                  vol->target.path, strerror(errno));
+            return -1;
+        } else {
+            vol->target.perms.label = NULL;
+        }
+    } else {
+        vol->target.perms.label = strdup(filecon);
+        if (vol->target.perms.label == NULL) {
+            virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("context"));
+            return -1;
+        }
+        freecon(filecon);
     }
-    freecon(filecon);
 #else
     vol->target.perms.label = NULL;
 #endif