diff options
| author | Steve Bavin <pondlife@pondlife.me> | 2008-05-13 13:49:50 +0000 |
|---|---|---|
| committer | Steve Bavin <pondlife@pondlife.me> | 2008-05-13 13:49:50 +0000 |
| commit | bc186c1a6bd1f40739147b1ae6a388b7383764cb (patch) | |
| tree | 95a24f9573f609e0e6195db732a83f83d30eac9a | |
| parent | fa0eabdd9a5208cadf29d92d69509768147fcecd (diff) | |
| download | rockbox-bc186c1a6bd1f40739147b1ae6a388b7383764cb.zip rockbox-bc186c1a6bd1f40739147b1ae6a388b7383764cb.tar.gz rockbox-bc186c1a6bd1f40739147b1ae6a388b7383764cb.tar.bz2 rockbox-bc186c1a6bd1f40739147b1ae6a388b7383764cb.tar.xz | |
Fix FS#8986, problem where current file changes during deletion.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17494 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/onplay.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index a3cbebc..076f90c 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -524,13 +524,16 @@ static int remove_dir(char* dirname, int len) /* share code for file and directory deletion, saves space */ static bool delete_handler(bool is_dir) { + char file_to_delete[MAX_PATH]; + strcpy(file_to_delete, selected_file); + const char *lines[]={ ID2P(LANG_REALLY_DELETE), - selected_file + file_to_delete }; const char *yes_lines[]={ ID2P(LANG_DELETED), - selected_file + file_to_delete }; struct text_message message={lines, 2}; @@ -546,16 +549,16 @@ static bool delete_handler(bool is_dir) { char pathname[MAX_PATH]; /* space to go deep */ cpu_boost(true); - strncpy(pathname, selected_file, sizeof pathname); + strncpy(pathname, file_to_delete, sizeof pathname); res = remove_dir(pathname, sizeof(pathname)); cpu_boost(false); } else - res = remove(selected_file); + res = remove(file_to_delete); - if (!res) { + if (!res) onplay_result = ONPLAY_RELOAD_DIR; - } + return false; } |