forked from len0rd/rockbox
Make delete_file_dir() more threadsafe
This should fix FS#13263 Change-Id: I3527210117c716ab2133d6dc79597285d6e543e1
This commit is contained in:
parent
fe10830384
commit
befae2909f
1 changed files with 6 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue