diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2019-08-05 07:54:52 +0200 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2019-11-12 10:36:12 +0100 |
commit | 0602a6166df861c9fbbe72321c1a598c5fe1feb4 (patch) | |
tree | e1c1091dae73d9a60055f9af0c31ea63637f1d5e /contrib | |
parent | 88ed5db16c9b8ee2a6ec6d285f542b0a68a3c6e1 (diff) |
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>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ivshmem-server/ivshmem-server.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index 77f97b209c..88daee812d 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -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; |