mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 15:36:04 +00:00
When someone tries to copy a file over itself, show an error message.
We already had such a check in the code, but after Brandon's copy.c rewrite in r16561, it never got called. I removed the old check now and put a new one at the right position. See issue #2827 for more details. svn path=/trunk/; revision=30696
This commit is contained in:
parent
ccba9533e8
commit
8d91a510a9
1 changed files with 7 additions and 11 deletions
|
@ -173,16 +173,6 @@ copy (TCHAR source[MAX_PATH],
|
||||||
}
|
}
|
||||||
else if (!append)
|
else if (!append)
|
||||||
{
|
{
|
||||||
if (!_tcscmp (dest, source))
|
|
||||||
{
|
|
||||||
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
|
||||||
ConOutPrintf(szMsg, source);
|
|
||||||
|
|
||||||
CloseHandle (hFileSrc);
|
|
||||||
nErrorLevel = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf (_T("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n"), dest);
|
DebugPrintf (_T("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n"), dest);
|
||||||
#endif
|
#endif
|
||||||
|
@ -830,7 +820,13 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
/* Check to see if the file is the same file */
|
/* Check to see if the file is the same file */
|
||||||
if(!bTouch && !_tcscmp (tmpSrcPath, tmpDestPath))
|
if(!bTouch && !_tcscmp (tmpSrcPath, tmpDestPath))
|
||||||
continue;
|
{
|
||||||
|
LoadString(CMD_ModuleHandle, STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||||
|
ConOutPrintf(szMsg);
|
||||||
|
|
||||||
|
nErrorLevel = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle any overriding / prompting that needs to be done */
|
/* Handle any overriding / prompting that needs to be done */
|
||||||
if(((!(dwFlags & COPY_NO_PROMPT) && IsExistingFile (tmpDestPath)) || dwFlags & COPY_PROMPT) && !bTouch)
|
if(((!(dwFlags & COPY_NO_PROMPT) && IsExistingFile (tmpDestPath)) || dwFlags & COPY_PROMPT) && !bTouch)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue