mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:53:02 +01:00
Fix bug causing profile to be overwritten under a rare condition
This commit is contained in:
parent
f707dce2da
commit
a95fc7824c
@ -1101,6 +1101,9 @@ static int rename_old_profile(const char *user_config_dir)
|
|||||||
if (!file_exists(old_data_file))
|
if (!file_exists(old_data_file))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (file_exists(DATA_FILE))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (rename(old_data_file, DATA_FILE) != 0)
|
if (rename(old_data_file, DATA_FILE) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -1112,6 +1115,9 @@ static int rename_old_profile(const char *user_config_dir)
|
|||||||
if (!file_exists(old_data_blocklist))
|
if (!file_exists(old_data_blocklist))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (file_exists(BLOCK_FILE))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (rename(old_data_blocklist, BLOCK_FILE) != 0)
|
if (rename(old_data_blocklist, BLOCK_FILE) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user