summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-18 20:49:28 +0000
committerAJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-18 20:49:28 +0000
commit132f1beae35162e24675912b55b2f34f9d473cbc (patch)
tree007c99667ce32a440aad5c93c8f8525f49781ea7
parentf711436ba58b7cdb29881b9096dd9f39fe767c42 (diff)
downloadedk2-platforms-132f1beae35162e24675912b55b2f34f9d473cbc.tar.xz
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
-rw-r--r--UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c b/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c
index b46c9dce97..a0c75f578b 100644
--- a/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c
+++ b/UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.c
@@ -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;
}