Skip to content

Commit

Permalink
dbg: use secure fs_fopen()
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Feb 4, 2022
1 parent ea7641b commit be1e25a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/dbg/dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <re_fmt.h>
#include <re_list.h>
#include <re_tmr.h>
#include <re_sys.h>


#define DEBUG_MODULE "dbg"
Expand Down Expand Up @@ -99,14 +100,16 @@ void dbg_close(void)
*/
int dbg_logfile_set(const char *name)
{
int err;

dbg_close();

if (!name)
return 0;

dbg.f = fopen(name, "a+");
if (!dbg.f)
return errno;
err = fs_fopen(&dbg.f, name, "a+");
if (err)
return err;

(void)re_fprintf(dbg.f, "\n===== Log Started: %H", fmt_gmtime, NULL);
(void)fflush(dbg.f);
Expand Down

0 comments on commit be1e25a

Please sign in to comment.