[libvirt] [PATCH] util: remove unnecessary code to avoid error overwrite
John Ferlan
jferlan at redhat.com
Wed Oct 28 21:21:33 UTC 2015
On 10/28/2015 03:06 AM, Luyao Huang wrote:
> virCgroupRemove use VIR_ERROR to log the error and won't
> change the virLastErr in the thread, so no need do this.
>
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
> src/util/vircgroup.c | 10 ----------
> 1 file changed, 10 deletions(-)
>
Although virCgroupRemove calls virCgroupRemoveRecursively to remove the
cgroups and as noted in the recursive function the usage of VIR_ERROR
instead of virReportError is true.
However, virCgroupRemove also calls virCgroupPathOfController which
calls virReport[System]Error so I don't think we can 'remove' these
overwrite protections... Consider the case when the recursive function
is never called because we keep continuing.
John
> diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
> index 0379c2e..a120a15 100644
> --- a/src/util/vircgroup.c
> +++ b/src/util/vircgroup.c
> @@ -1670,13 +1670,8 @@ virCgroupNewMachineSystemd(const char *name,
> }
>
> if (virCgroupAddTask(*group, pidleader) < 0) {
> - virErrorPtr saved = virSaveLastError();
> virCgroupRemove(*group);
> virCgroupFree(group);
> - if (saved) {
> - virSetError(saved);
> - virFreeError(saved);
> - }
> }
>
> ret = 0;
> @@ -1728,13 +1723,8 @@ virCgroupNewMachineManual(const char *name,
> goto cleanup;
>
> if (virCgroupAddTask(*group, pidleader) < 0) {
> - virErrorPtr saved = virSaveLastError();
> virCgroupRemove(*group);
> virCgroupFree(group);
> - if (saved) {
> - virSetError(saved);
> - virFreeError(saved);
> - }
> }
>
> done:
>
More information about the libvir-list
mailing list