summaryrefslogtreecommitdiff
path: root/firmware/target/hosted
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-03-31 22:08:55 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2024-04-01 07:35:53 -0400
commit1dc22c7241e7a4560bc2ba5e920721df27c39778 (patch)
tree92005f1c98456b2db0cf78d30df9f0f648f75faf /firmware/target/hosted
parent47784a777eca6cae3c4a6643f4bca5338373951f (diff)
downloadrockbox-1dc22c7241e7a4560bc2ba5e920721df27c39778.tar.gz
rockbox-1dc22c7241e7a4560bc2ba5e920721df27c39778.zip
use path_append for setting directories is several settings
sprintf, strcpy, memccpy can all just go thru path_append with the added benefit of some path sanitizing too Change-Id: I33510b56a364b8b3a0b06f2ff14b76491f6e3870
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r--firmware/target/hosted/filesystem-app.c4
-rw-r--r--firmware/target/hosted/rolo.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c
index 09b3365a9e..b36f04a0fe 100644
--- a/firmware/target/hosted/filesystem-app.c
+++ b/firmware/target/hosted/filesystem-app.c
@@ -211,7 +211,7 @@ const char * handle_special_dirs(const char *dir, unsigned flags,
211 { 211 {
212 const char *p = dir + HOME_DIR_LEN; 212 const char *p = dir + HOME_DIR_LEN;
213 while (*p == '/') p++; 213 while (*p == '/') p++;
214 snprintf(buf, bufsize, "%s/%s", rbhome, p); 214 path_append(buf, rbhome, p, bufsize);
215 dir = buf; 215 dir = buf;
216 } 216 }
217 else if (!strncmp(ROCKBOX_DIR, dir, ROCKBOX_DIR_LEN)) 217 else if (!strncmp(ROCKBOX_DIR, dir, ROCKBOX_DIR_LEN))
@@ -232,7 +232,7 @@ const char * handle_special_dirs(const char *dir, unsigned flags,
232#endif 232#endif
233 ) 233 )
234 { 234 {
235 snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir); 235 path_append(buf, PIVOT_ROOT, dir, bufsize);
236 dir = buf; 236 dir = buf;
237 } 237 }
238#endif 238#endif
diff --git a/firmware/target/hosted/rolo.c b/firmware/target/hosted/rolo.c
index dfe483c964..87b7340198 100644
--- a/firmware/target/hosted/rolo.c
+++ b/firmware/target/hosted/rolo.c
@@ -33,6 +33,7 @@
33#include "storage.h" 33#include "storage.h"
34#include "rolo.h" 34#include "rolo.h"
35#include "rbpaths.h" 35#include "rbpaths.h"
36#include "pathfuncs.h"
36 37
37//#define LOGF_ENABLE 38//#define LOGF_ENABLE
38#include "logf.h" 39#include "logf.h"
@@ -94,9 +95,9 @@ int rolo_load(const char* filename)
94 logf("system: %s", buf); 95 logf("system: %s", buf);
95 system(buf); 96 system(buf);
96 97
97 snprintf(buf, sizeof(buf), "%s/%s", EXECDIR, BOOTFILE); 98 path_append(buf, EXECDIR, BOOTFILE, sizeof(buf));
98#else 99#else
99 snprintf(buf, sizeof(buf), "%s/%s", EXECDIR, filename); 100 path_append(buf, EXECDIR, filename, sizeof(buf));
100#endif 101#endif
101 102
102 logf("execl: %s", buf); 103 logf("execl: %s", buf);