1
0
Fork 0
forked from len0rd/rockbox

misc.c open_pathfmt caller supplied buffer

Amachronic raised concern about open() blocking causing a static buf
to get overwritten in multiple calls its prudent to just have the caller
supply the buffer to minimize stack issues later

Change-Id: Iae27c7d063adb1a65688f920f6aa5c395fa5694a
This commit is contained in:
William Wilgus 2022-11-23 21:46:13 -05:00
parent 80b8b13544
commit 3745c813f9
9 changed files with 34 additions and 27 deletions

View file

@ -2307,8 +2307,9 @@ static bool cpu_boost_log_dump(void)
return false;
#if CONFIG_RTC
char fname[MAX_PATH];
struct tm *nowtm = get_time();
fd = open_pathfmt(O_CREAT|O_WRONLY|O_TRUNC,
fd = open_pathfmt(fname, sizeof(fname), O_CREAT|O_WRONLY|O_TRUNC,
"%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR,
nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday,
nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec);