Skip to content

Commit

Permalink
protect ovis_log_flush from invalid arguments.
Browse files Browse the repository at this point in the history
ovis_log_flush can be called in any order wrt initialization,
so it must be guarded against null and syslog values.
  • Loading branch information
baallan authored and tom95858 committed Jan 22, 2024
1 parent 36ddbf8 commit 8640f27
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/ovis_log/ovis_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,9 @@ int ovis_log_open(const char *path)

int ovis_log_flush()
{
return fflush(log_fp);
if (log_fp && log_fp != OVIS_LOG_SYSLOG)
return fflush(log_fp);
return 0;
}

int ovis_log_close()
Expand Down

0 comments on commit 8640f27

Please sign in to comment.