1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 01:43:01 +01:00

Fix bug causing profile to be overwritten under a rare condition

This commit is contained in:
Jfreegman 2015-11-05 16:15:59 -05:00
parent f707dce2da
commit a95fc7824c
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -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;