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