summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMoshe Piekarski <dev.rockbox@melachim.net>2021-01-11 12:38:35 -0500
committerSolomon Peachy <pizza@shaftnet.org>2021-01-21 14:27:06 +0000
commitbefae2909f56ff81278e73e963a707537057459f (patch)
tree9cb34a37a5bcc22b4f361f944ca024b65af07c1e /apps
parentfe108303841eb241c0eb9142aefe57e3de698dbd (diff)
downloadrockbox-befae2909f56ff81278e73e963a707537057459f.tar.gz
rockbox-befae2909f56ff81278e73e963a707537057459f.tar.bz2
rockbox-befae2909f56ff81278e73e963a707537057459f.zip
Make delete_file_dir() more threadsafe
This should fix FS#13263 Change-Id: I3527210117c716ab2133d6dc79597285d6e543e1
Diffstat (limited to 'apps')
-rw-r--r--apps/onplay.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index ded2994c97..5b22e72443 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -949,7 +949,9 @@ static int remove_dir(struct dirrecurse_params *parm)
/* share code for file and directory deletion, saves space */
static int delete_file_dir(void)
{
- if (confirm_delete(selected_file) != YESNO_YES) {
+ const char *to_delete=selected_file;
+ const int to_delete_attr=selected_file_attr;
+ if (confirm_delete(to_delete) != YESNO_YES) {
return 1;
}
@@ -958,9 +960,9 @@ static int delete_file_dir(void)
int rc = -1;
- if (selected_file_attr & ATTR_DIRECTORY) { /* true if directory */
+ if (to_delete_attr & ATTR_DIRECTORY) { /* true if directory */
struct dirrecurse_params parm;
- parm.append = strlcpy(parm.path, selected_file, sizeof (parm.path));
+ parm.append = strlcpy(parm.path, to_delete, sizeof (parm.path));
if (parm.append < sizeof (parm.path)) {
cpu_boost(true);
@@ -968,7 +970,7 @@ static int delete_file_dir(void)
cpu_boost(false);
}
} else {
- rc = remove(selected_file);
+ rc = remove(to_delete);
}
if (rc < OPRC_SUCCESS) {