summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-02-27 10:06:55 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-02-27 10:06:55 +0000
commit96016e40598006c4e78837f3714163055af99b40 (patch)
tree61c14cf442d72f85aa511b4150fd007ffb824aee
parent4721deff014637724ba46469f585de0cc16492f3 (diff)
downloadrockbox-96016e40598006c4e78837f3714163055af99b40.zip
rockbox-96016e40598006c4e78837f3714163055af99b40.tar.gz
rockbox-96016e40598006c4e78837f3714163055af99b40.tar.bz2
rockbox-96016e40598006c4e78837f3714163055af99b40.tar.xz
fix FS#6700. If you really need to paste into the source directory, do
it on the computer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12503 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/onplay.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index 18a0ff6..6408019 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
- * Copyright (C) 2002 Björn Stenberg
+ * Copyright (C) 2002 Bj�n Stenberg
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
@@ -822,11 +822,19 @@ static bool clipboard_paste(void)
/* Recursion. Set up external stack */
char srcpath[MAX_PATH];
char targetpath[MAX_PATH];
-
- strncpy(srcpath, clipboard_selection, sizeof srcpath);
- strncpy(targetpath, target, sizeof targetpath);
-
- success = clipboard_pastedirectory(srcpath, sizeof(srcpath), target, sizeof(targetpath), clipboard_is_copy);
+ if (!strncmp(clipboard_selection, target, strlen(clipboard_selection)))
+ {
+ /* Do not allow the user to paste a directory into a dir they are copying */
+ success = 0;
+ }
+ else
+ {
+ strncpy(srcpath, clipboard_selection, sizeof srcpath);
+ strncpy(targetpath, target, sizeof targetpath);
+
+ success = clipboard_pastedirectory(srcpath, sizeof(srcpath),
+ target, sizeof(targetpath), clipboard_is_copy);
+ }
} else {
success = clipboard_pastefile(clipboard_selection, target, clipboard_is_copy);
}