Re: [PATCH] util: remove unnecessary code to avoid error overwrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>
> ---
>  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:
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]