mirror of
https://github.com/schoebel/mars
synced 2025-01-19 22:10:47 +00:00
light: fix potential flaw in primary switching
This commit is contained in:
parent
b32927a20d
commit
7cd1281d2c
@ -2336,8 +2336,12 @@ int make_log_init(void *buf, struct mars_dent *dent)
|
||||
if (unlikely(!aio_dent)) {
|
||||
MARS_DBG("logfile '%s' does not exist\n", aio_path);
|
||||
status = -ENOENT;
|
||||
if (rot->todo_primary) { // try to create an empty logfile
|
||||
_create_new_logfile(aio_path);
|
||||
if (rot->todo_primary && !rot->is_primary && !rot->old_is_primary) {
|
||||
int offset = strlen(aio_path) - strlen(my_id());
|
||||
if (offset > 0 && aio_path[offset-1] == '-' && !strcmp(aio_path + offset, my_id())) {
|
||||
// try to create an empty logfile
|
||||
_create_new_logfile(aio_path);
|
||||
}
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user