aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/hv/hv_kvp_daemon.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 384051745c5e..c800ea4c8bf9 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -151,7 +151,7 @@ static void kvp_update_file(int pool)
151 */ 151 */
152 kvp_acquire_lock(pool); 152 kvp_acquire_lock(pool);
153 153
154 filep = fopen(kvp_file_info[pool].fname, "w"); 154 filep = fopen(kvp_file_info[pool].fname, "we");
155 if (!filep) { 155 if (!filep) {
156 kvp_release_lock(pool); 156 kvp_release_lock(pool);
157 syslog(LOG_ERR, "Failed to open file, pool: %d", pool); 157 syslog(LOG_ERR, "Failed to open file, pool: %d", pool);
@@ -182,7 +182,7 @@ static void kvp_update_mem_state(int pool)
182 182
183 kvp_acquire_lock(pool); 183 kvp_acquire_lock(pool);
184 184
185 filep = fopen(kvp_file_info[pool].fname, "r"); 185 filep = fopen(kvp_file_info[pool].fname, "re");
186 if (!filep) { 186 if (!filep) {
187 kvp_release_lock(pool); 187 kvp_release_lock(pool);
188 syslog(LOG_ERR, "Failed to open file, pool: %d", pool); 188 syslog(LOG_ERR, "Failed to open file, pool: %d", pool);
@@ -246,13 +246,13 @@ static int kvp_file_init(void)
246 records_read = 0; 246 records_read = 0;
247 num_blocks = 1; 247 num_blocks = 1;
248 sprintf(fname, "%s/.kvp_pool_%d", KVP_CONFIG_LOC, i); 248 sprintf(fname, "%s/.kvp_pool_%d", KVP_CONFIG_LOC, i);
249 fd = open(fname, O_RDWR | O_CREAT, 0644 /* rw-r--r-- */); 249 fd = open(fname, O_RDWR | O_CREAT | O_CLOEXEC, 0644 /* rw-r--r-- */);
250 250
251 if (fd == -1) 251 if (fd == -1)
252 return 1; 252 return 1;
253 253
254 254
255 filep = fopen(fname, "r"); 255 filep = fopen(fname, "re");
256 if (!filep) 256 if (!filep)
257 return 1; 257 return 1;
258 258