mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-16 04:03:02 +01:00
fix for issue #254
This commit is contained in:
parent
773a75b948
commit
48cf4ebf02
@ -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);
|
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);
|
free(user_config_dir);
|
||||||
|
|
||||||
log->file = fopen(log_path, "a+");
|
log->file = fopen(log_path, "a+");
|
||||||
|
|
||||||
snprintf(log->path, sizeof(log->path), "%s", log_path);
|
snprintf(log->path, sizeof(log->path), "%s", log_path);
|
||||||
|
|
||||||
if (log->file == NULL)
|
if (log->file == NULL)
|
||||||
@ -174,6 +174,12 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
|
|||||||
if (hstbuf == NULL)
|
if (hstbuf == NULL)
|
||||||
exit_toxic_err("failed in load_chat_history", FATALERR_MEMORY);
|
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) {
|
if (fread(hstbuf, sz, 1, log->file) != 1) {
|
||||||
free(hstbuf);
|
free(hstbuf);
|
||||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to read log file");
|
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, RED, " * Failed to read log file");
|
||||||
|
Loading…
Reference in New Issue
Block a user