1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-09-28 02:15:34 +02:00

fix for issue #254

This commit is contained in:
Jfreegman 2014-09-23 21:32:05 -04:00
parent 773a75b948
commit 48cf4ebf02
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
2 changed files with 10 additions and 4 deletions

View File

@ -89,8 +89,8 @@ static int init_logging_session(char *name, const char *selfkey, const char *oth
snprintf(log_path, sizeof(log_path), "%s%s%s-%s%s%s.log", user_config_dir, LOGDIR, self_id, name, namedash, other_id);
free(user_config_dir);
log->file = fopen(log_path, "a+");
snprintf(log->path, sizeof(log->path), "%s", log_path);
if (log->file == NULL)
@ -174,6 +174,12 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
if (hstbuf == NULL)
exit_toxic_err("failed in load_chat_history", FATALERR_MEMORY);
if (fseek(log->file, 0L, SEEK_SET) == -1) {
free(hstbuf);
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to read log file");
return;
}
if (fread(hstbuf, sz, 1, log->file) != 1) {
free(hstbuf);
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to read log file");