From: Michal Privoznik Date: Fri, 22 Mar 2019 14:41:06 +0000 (+0100) Subject: virFileRemoveXAttr: Report error on failure X-Git-Tag: v5.6.0-rc1~360 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1596199067013f4a57fdd2e40c80c6c3eaa778c8;p=thirdparty%2Flibvirt.git virFileRemoveXAttr: Report error on failure It's better to have the function report errors, because none of the callers does. Signed-off-by: Michal Privoznik Reviewed-by: Cole Robinson Reviewed-by: Daniel P. Berrangé --- diff --git a/src/util/virfile.c b/src/util/virfile.c index 75ec9e0bd8..b351f72bef 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -4446,13 +4446,20 @@ virFileSetXAttr(const char *path, * Remove xattr of @name on @path. * * Returns: 0 on success, - * -1 otherwise (with errno set). + * -1 otherwise (with errno set AND error reported). */ int virFileRemoveXAttr(const char *path, const char *name) { - return removexattr(path, name); + if (removexattr(path, name) < 0) { + virReportSystemError(errno, + _("Unable to remove XATTR %s on %s"), + name, path); + return -1; + } + + return 0; } #else /* !HAVE_LIBATTR */ @@ -4479,10 +4486,13 @@ virFileSetXAttr(const char *path, } int -virFileRemoveXAttr(const char *path ATTRIBUTE_UNUSED, - const char *name ATTRIBUTE_UNUSED) +virFileRemoveXAttr(const char *path, + const char *name) { errno = ENOSYS; + virReportSystemError(errno, + _("Unable to remove XATTR %s on %s"), + name, path); return -1; }