Re: [PATCH 3/1] command: add virCommandAbort for cleanup paths

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

 



On Tue, Mar 22, 2011 at 04:45:09PM -0600, Eric Blake wrote:
> Sometimes, an asynchronous helper is started (such as a compressor
> or iohelper program), but a later error means that we want to
> abort that child.  Make this easier.
> 
>  /*
> @@ -1207,6 +1208,8 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
> 
>      if (ret == 0 && pid)
>          *pid = cmd->pid;
> +    else
> +        cmd->reap = true;
> 
>      return ret;
>  }

[snip]

> @@ -1305,5 +1368,8 @@ virCommandFree(virCommandPtr cmd)
> 
>      VIR_FREE(cmd->pidfile);
> 
> +    if (cmd->reap)
> +        virCommandAbort(cmd);
> +
>      VIR_FREE(cmd);
>  }

We allow  virCommandRunAsync to be used for daemonized
commands, so I don't think it is safe to unconditionally
kill off the PID when free'ing the virCommandPtr instance.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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