properly shutdown of clients

This commit is contained in:
Martin Willi
2007-07-27 10:17:50 +00:00
parent 539a55a441
commit 99652427e9
3 changed files with 22 additions and 6 deletions
+3 -2
View File
@@ -227,10 +227,10 @@ static void stop(private_guest_t *this)
{
if (this->state != GUEST_STOPPED)
{
this->state = GUEST_STOPPING;
this->ifaces->destroy_offset(this->ifaces, offsetof(iface_t, destroy));
this->ifaces = linked_list_create();
kill(this->pid, SIGINT);
this->state = GUEST_STOPPING;
while (this->state == GUEST_STOPPING)
{
sched_yield();
@@ -243,6 +243,8 @@ static void stop(private_guest_t *this)
*/
static void sigchild(private_guest_t *this)
{
DESTROY_IF(this->mconsole);
this->mconsole = NULL;
this->state = GUEST_STOPPED;
this->pid = 0;
}
@@ -341,7 +343,6 @@ static void destroy(private_guest_t *this)
{
stop(this);
umount_unionfs(this->name);
DESTROY_IF(this->mconsole);
free(this->name);
free(this->master);
free(this);