summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2008-05-13 13:49:50 +0000
committerSteve Bavin <pondlife@pondlife.me>2008-05-13 13:49:50 +0000
commitbc186c1a6bd1f40739147b1ae6a388b7383764cb (patch)
tree95a24f9573f609e0e6195db732a83f83d30eac9a
parentfa0eabdd9a5208cadf29d92d69509768147fcecd (diff)
downloadrockbox-bc186c1a6bd1f40739147b1ae6a388b7383764cb.tar.gz
rockbox-bc186c1a6bd1f40739147b1ae6a388b7383764cb.zip
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.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index a3cbebc2ff..076f90ca59 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -524,13 +524,16 @@ static int remove_dir(char* dirname, int len)
524/* share code for file and directory deletion, saves space */ 524/* share code for file and directory deletion, saves space */
525static bool delete_handler(bool is_dir) 525static bool delete_handler(bool is_dir)
526{ 526{
527 char file_to_delete[MAX_PATH];
528 strcpy(file_to_delete, selected_file);
529
527 const char *lines[]={ 530 const char *lines[]={
528 ID2P(LANG_REALLY_DELETE), 531 ID2P(LANG_REALLY_DELETE),
529 selected_file 532 file_to_delete
530 }; 533 };
531 const char *yes_lines[]={ 534 const char *yes_lines[]={
532 ID2P(LANG_DELETED), 535 ID2P(LANG_DELETED),
533 selected_file 536 file_to_delete
534 }; 537 };
535 538
536 struct text_message message={lines, 2}; 539 struct text_message message={lines, 2};
@@ -546,16 +549,16 @@ static bool delete_handler(bool is_dir)
546 { 549 {
547 char pathname[MAX_PATH]; /* space to go deep */ 550 char pathname[MAX_PATH]; /* space to go deep */
548 cpu_boost(true); 551 cpu_boost(true);
549 strncpy(pathname, selected_file, sizeof pathname); 552 strncpy(pathname, file_to_delete, sizeof pathname);
550 res = remove_dir(pathname, sizeof(pathname)); 553 res = remove_dir(pathname, sizeof(pathname));
551 cpu_boost(false); 554 cpu_boost(false);
552 } 555 }
553 else 556 else
554 res = remove(selected_file); 557 res = remove(file_to_delete);
555 558
556 if (!res) { 559 if (!res)
557 onplay_result = ONPLAY_RELOAD_DIR; 560 onplay_result = ONPLAY_RELOAD_DIR;
558 } 561
559 return false; 562 return false;
560} 563}
561 564