Fix a bug with the shell cp command. When searching for a / it was possible to lose a directory level. I changed the code to add a missing / if needed and not search backwards for one.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9578 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
AJFISH 2009-12-18 20:49:28 +00:00
parent f711436ba5
commit 132f1beae3
1 changed files with 6 additions and 4 deletions

View File

@ -1895,7 +1895,7 @@ Returns:
} else {
Status = gBS->AllocatePool (
EfiBootServicesData,
AsciiStrLen (PrivateFile->FileName) + 1 + StrLen (NewFileInfo->FileName) + 1,
AsciiStrLen (PrivateFile->FileName) + 2 + StrLen (NewFileInfo->FileName) + 1,
(VOID **)&NewFileName
);
@ -1905,8 +1905,11 @@ Returns:
AsciiStrCpy (NewFileName, PrivateRoot->FilePath);
AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName);
while (AsciiFilePtr > NewFileName && AsciiFilePtr[-1] != '/') {
AsciiFilePtr--;
if ((AsciiFilePtr[-1] != '/') && (NewFileInfo->FileName[0] != '/')) {
// make sure there is a / between Root FilePath and NewFileInfo Filename
AsciiFilePtr[0] = '/';
AsciiFilePtr[1] = '\0';
AsciiFilePtr++;
}
UnicodeFilePtr = NewFileInfo->FileName;
}
@ -2091,7 +2094,6 @@ Returns:
}
UnixStatus = PrivateFile->UnixThunk->Chmod (NewFileName, NewAttr);
if (UnixStatus != 0) {
Status = EFI_DEVICE_ERROR;
}