From 96016e40598006c4e78837f3714163055af99b40 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 27 Feb 2007 10:06:55 +0000 Subject: 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 --- apps/onplay.c | 20 ++++++++++++++------ 1 file 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); } -- cgit v1.1