mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virFileSetXAttr: Report error on failure
It's better to have the function report errors, because none of the callers does. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
0d44d2876a
commit
9b130c33f9
@ -4421,14 +4421,21 @@ virFileGetXAttrQuiet(const char *path,
|
|||||||
* Sets xattr of @name and @value on @path.
|
* Sets xattr of @name and @value on @path.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success,
|
* Returns: 0 on success,
|
||||||
* -1 otherwise (with errno set).
|
* -1 otherwise (with errno set AND error reported).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virFileSetXAttr(const char *path,
|
virFileSetXAttr(const char *path,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char *value)
|
const char *value)
|
||||||
{
|
{
|
||||||
return setxattr(path, name, value, strlen(value), 0);
|
if (setxattr(path, name, value, strlen(value), 0) < 0) {
|
||||||
|
virReportSystemError(errno,
|
||||||
|
_("Unable to set XATTR %s on %s"),
|
||||||
|
name, path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4460,11 +4467,14 @@ virFileGetXAttrQuiet(const char *path ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
virFileSetXAttr(const char *path ATTRIBUTE_UNUSED,
|
virFileSetXAttr(const char *path,
|
||||||
const char *name ATTRIBUTE_UNUSED,
|
const char *name,
|
||||||
const char *value ATTRIBUTE_UNUSED)
|
const char *value ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
errno = ENOSYS;
|
errno = ENOSYS;
|
||||||
|
virReportSystemError(errno,
|
||||||
|
_("Unable to set XATTR %s on %s"),
|
||||||
|
name, path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user