|
|
e2c81d |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
2be4b2 |
From: Frediano Ziglio <fziglio@redhat.com>
|
|
|
2be4b2 |
Date: Wed, 15 Jul 2015 14:15:52 +0100
|
|
|
2be4b2 |
Subject: [PATCH] reds: Assure we don't have stale statistic files before
|
|
|
2be4b2 |
trying to create a new one
|
|
|
2be4b2 |
|
|
|
2be4b2 |
If a previous Qemu executable is not able to delete the statistic file
|
|
|
2be4b2 |
on the next creation with same name (statitics file are based on pid
|
|
|
2be4b2 |
numbers so if pid get reused for another Qemu process you get the same
|
|
|
2be4b2 |
name) it fails as you can't open a file with 0444 permissions (these
|
|
|
2be4b2 |
are the permission used to create these files).
|
|
|
2be4b2 |
This patch assure there are no stale file trying to remove it before the
|
|
|
2be4b2 |
creation of the new one. As file is based on pid and name used for spice
|
|
|
2be4b2 |
you are not deleting another file.
|
|
|
2be4b2 |
|
|
|
2be4b2 |
Fixes: rhbz#1177326
|
|
|
2be4b2 |
|
|
|
2be4b2 |
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
|
|
|
2be4b2 |
---
|
|
|
2be4b2 |
server/reds.c | 1 +
|
|
|
2be4b2 |
1 file changed, 1 insertion(+)
|
|
|
2be4b2 |
|
|
|
2be4b2 |
diff --git a/server/reds.c b/server/reds.c
|
|
|
e2c81d |
index f996c71..e96f28d 100644
|
|
|
2be4b2 |
--- a/server/reds.c
|
|
|
2be4b2 |
+++ b/server/reds.c
|
|
|
e2c81d |
@@ -4011,6 +4011,7 @@ static int do_spice_init(SpiceCoreInterface *core_interface)
|
|
|
2be4b2 |
shm_name_len = strlen(SPICE_STAT_SHM_NAME) + 20;
|
|
|
2be4b2 |
reds->stat_shm_name = (char *)spice_malloc(shm_name_len);
|
|
|
2be4b2 |
snprintf(reds->stat_shm_name, shm_name_len, SPICE_STAT_SHM_NAME, getpid());
|
|
|
2be4b2 |
+ shm_unlink(reds->stat_shm_name);
|
|
|
2be4b2 |
if ((fd = shm_open(reds->stat_shm_name, O_CREAT | O_RDWR, 0444)) == -1) {
|
|
|
2be4b2 |
spice_error("statistics shm_open failed, %s", strerror(errno));
|
|
|
2be4b2 |
}
|