From 3745c813f924b12232c4f37610aecd23fe5654b8 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 23 Nov 2022 21:46:13 -0500 Subject: 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 --- apps/logfdisp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apps/logfdisp.c') diff --git a/apps/logfdisp.c b/apps/logfdisp.c index aebc9ffb33..efbfa192f5 100644 --- a/apps/logfdisp.c +++ b/apps/logfdisp.c @@ -225,8 +225,9 @@ bool logfdump(void) logfenabled = 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/logf_%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); -- cgit v1.2.3