mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Create swap file only if not exists
This commit is contained in:
parent
459f52a8aa
commit
6fa987e390
8
redis.c
8
redis.c
@ -7035,9 +7035,13 @@ static void vmInit(void) {
|
|||||||
|
|
||||||
expandVmSwapFilename();
|
expandVmSwapFilename();
|
||||||
redisLog(REDIS_NOTICE,"Using '%s' as swap file",server.vm_swap_file);
|
redisLog(REDIS_NOTICE,"Using '%s' as swap file",server.vm_swap_file);
|
||||||
server.vm_fp = fopen(server.vm_swap_file,"r+b");
|
if ((server.vm_fp = fopen(server.vm_swap_file,"r+b")) == NULL) {
|
||||||
|
server.vm_fp = fopen(server.vm_swap_file,"w+b");
|
||||||
|
}
|
||||||
if (server.vm_fp == NULL) {
|
if (server.vm_fp == NULL) {
|
||||||
redisLog(REDIS_WARNING,"Impossible to open the swap file. Exiting.");
|
redisLog(REDIS_WARNING,
|
||||||
|
"Impossible to open the swap file: %s. Exiting.",
|
||||||
|
strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
server.vm_fd = fileno(server.vm_fp);
|
server.vm_fd = fileno(server.vm_fp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user