Re: [libvirt PATCH 1/6] virProcessKillPainfullyDelay: use 'rc' variable

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

 



On 8/3/21 5:13 PM, Ján Tomko wrote:
> Use 'rc' to store the return value of virProcessKill,
> to separate the value check from the function call.
> 
> Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
> ---
>  src/util/virprocess.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/util/virprocess.c b/src/util/virprocess.c
> index 67dd599b3e..d58e983b56 100644
> --- a/src/util/virprocess.c
> +++ b/src/util/virprocess.c
> @@ -395,6 +395,8 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
>       */
>      for (i = 0; i < polldelay; i++) {
>          int signum;
> +        int rc;
> +
>          if (i == 0) {
>              signum = SIGTERM; /* kindly suggest it should exit */
>          } else if (i == 50 && force) {
> @@ -413,7 +415,9 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
>              signum = 0; /* Just check for existence */
>          }
>  
> -        if (virProcessKill(pid, signum) < 0) {
> +        rc = virProcessKill(pid, signum);
> +
> +        if (rc < 0) {
>              if (errno != ESRCH) {
>                  virReportSystemError(errno,
>                                       _("Failed to terminate process %lld with SIG%s"),
> 

This patch alone makes no sense. Squash it to the one where you need to
differentiate whether to kill just a single PID or whole group (patch
5/6 which will effectively be 4/6).

Michal




[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]

  Powered by Linux