提交 d8b363c3 编写于 作者: D Daniel P. Berrange

Cope with missing selinux attribute

上级 ca7047f1
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> Mon Mar 17 11:46:09 CET 2008 Daniel Veillard <veillard@redhat.com>
* src/libvirt.c docs/libvirt-*.xml docs/html/libvirt-libvirt.html: * src/libvirt.c docs/libvirt-*.xml docs/html/libvirt-libvirt.html:
......
...@@ -240,17 +240,22 @@ virStorageBackendUpdateVolInfoFD(virConnectPtr conn, ...@@ -240,17 +240,22 @@ virStorageBackendUpdateVolInfoFD(virConnectPtr conn,
#if HAVE_SELINUX #if HAVE_SELINUX
if (fgetfilecon(fd, &filecon) == -1) { if (fgetfilecon(fd, &filecon) == -1) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, if (errno != ENODATA) {
_("cannot get file context of %s: %s"), virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
vol->target.path, strerror(errno)); _("cannot get file context of %s: %s"),
return -1; vol->target.path, strerror(errno));
} return -1;
vol->target.perms.label = strdup(filecon); } else {
if (vol->target.perms.label == NULL) { vol->target.perms.label = NULL;
virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("context")); }
return -1; } 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 #else
vol->target.perms.label = NULL; vol->target.perms.label = NULL;
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册