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
This commit is contained in:
William Wilgus 2024-03-31 22:08:55 -04:00
parent 47784a777e
commit 1dc22c7241
7 changed files with 23 additions and 22 deletions

View file

@ -211,7 +211,7 @@ const char * handle_special_dirs(const char *dir, unsigned flags,
{
const char *p = dir + HOME_DIR_LEN;
while (*p == '/') p++;
snprintf(buf, bufsize, "%s/%s", rbhome, p);
path_append(buf, rbhome, p, bufsize);
dir = buf;
}
else if (!strncmp(ROCKBOX_DIR, dir, ROCKBOX_DIR_LEN))
@ -232,7 +232,7 @@ const char * handle_special_dirs(const char *dir, unsigned flags,
#endif
)
{
snprintf(buf, bufsize, "%s/%s", PIVOT_ROOT, dir);
path_append(buf, PIVOT_ROOT, dir, bufsize);
dir = buf;
}
#endif

View file

@ -33,6 +33,7 @@
#include "storage.h"
#include "rolo.h"
#include "rbpaths.h"
#include "pathfuncs.h"
//#define LOGF_ENABLE
#include "logf.h"
@ -94,9 +95,9 @@ int rolo_load(const char* filename)
logf("system: %s", buf);
system(buf);
snprintf(buf, sizeof(buf), "%s/%s", EXECDIR, BOOTFILE);
path_append(buf, EXECDIR, BOOTFILE, sizeof(buf));
#else
snprintf(buf, sizeof(buf), "%s/%s", EXECDIR, filename);
path_append(buf, EXECDIR, filename, sizeof(buf));
#endif
logf("execl: %s", buf);