mirror of https://gitee.com/openkylin/qemu.git
ivshmem-server: Clean up shmem on shutdown
So far, the server leaves the posix shared memory object behind when terminating, requiring the user to explicitly remove it in order to start a new instance. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Claudio Fontana <claudio.fontana@suse.com> Message-Id: <d938a62c-7538-9d2b-cc0a-13b240ab9141@web.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
88ed5db16c
commit
0602a6166d
|
@ -353,6 +353,9 @@ ivshmem_server_start(IvshmemServer *server)
|
|||
err_close_sock:
|
||||
close(sock_fd);
|
||||
err_close_shm:
|
||||
if (server->use_shm_open) {
|
||||
shm_unlink(server->shm_path);
|
||||
}
|
||||
close(shm_fd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -370,6 +373,9 @@ ivshmem_server_close(IvshmemServer *server)
|
|||
}
|
||||
|
||||
unlink(server->unix_sock_path);
|
||||
if (server->use_shm_open) {
|
||||
shm_unlink(server->shm_path);
|
||||
}
|
||||
close(server->sock_fd);
|
||||
close(server->shm_fd);
|
||||
server->sock_fd = -1;
|
||||
|
|
Loading…
Reference in New Issue