]> git.ipfire.org Git - thirdparty/libvirt.git/commit
command: add virCommandAbort for cleanup paths
authorEric Blake <eblake@redhat.com>
Tue, 22 Mar 2011 22:22:37 +0000 (16:22 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 25 Mar 2011 11:34:48 +0000 (05:34 -0600)
commit9ed545185f895d515aedc6d449e4bf0b2351ab79
tree0c3e79e9290de4147934fe9012a1a7709a813687
parent4e808602f14019449d3cea8b3d9aaf7513c34346
command: add virCommandAbort for cleanup paths

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.

Note that since daemons and virCommandRunAsync can't mix, the only
time virCommandFree can reap a process is if someone did
virCommandRunAsync for a non-daemon and didn't stash the pid.

* src/util/command.h (virCommandAbort): New prototype.
* src/util/command.c (_virCommand): Add new field.
(virCommandRunAsync, virCommandWait): Track whether pid was used.
(virCommandFree): Reap child if caller did not request pid.
(virCommandAbort): New function.
* src/libvirt_private.syms (command.h): Export it.
* tests/commandtest.c (test19): New test.
src/libvirt_private.syms
src/util/command.c
src/util/command.h
tests/commandtest.c