[libvirt] [PATCH] Report all errors in SELinuxRestoreSecurityFileLabel

From: Jiri Denemark <jdenemar@redhat.com> --- src/security/security_selinux.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 3e20475..1aabb20 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -364,12 +364,20 @@ SELinuxRestoreSecurityFileLabel(const char *path) goto err; } - if (stat(newpath, &buf) != 0) + if (stat(newpath, &buf) != 0) { + virReportSystemError(errno, + _("cannot stat %s"), newpath); goto err; + } if (matchpathcon(newpath, buf.st_mode, &fcon) == 0) { rc = SELinuxSetFilecon(newpath, fcon); + } else { + virSecurityReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot restore selinux file label for %s"), + newpath); } + err: VIR_FREE(fcon); VIR_FREE(newpath); -- 1.7.0.4

On Fri, Apr 30, 2010 at 01:50:10PM +0200, jdenemar@redhat.com wrote:
From: Jiri Denemark <jdenemar@redhat.com>
--- src/security/security_selinux.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 3e20475..1aabb20 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -364,12 +364,20 @@ SELinuxRestoreSecurityFileLabel(const char *path) goto err; }
- if (stat(newpath, &buf) != 0) + if (stat(newpath, &buf) != 0) { + virReportSystemError(errno, + _("cannot stat %s"), newpath); goto err; + }
if (matchpathcon(newpath, buf.st_mode, &fcon) == 0) { rc = SELinuxSetFilecon(newpath, fcon); + } else { + virSecurityReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot restore selinux file label for %s"), + newpath); } + err: VIR_FREE(fcon); VIR_FREE(newpath);
ACK, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel Veillard
-
jdenemar@redhat.com
-
Jiri Denemark