From f8db6527da8678f1480f08ba99b745279e8d104a Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Wed, 14 Sep 2016 13:59:01 +0800 Subject: BaseTools: Fix the bug to handle the read-only file change the 'r+b' to 'rb' for some file's open, since these files we only read it and no need to write. It can fix the bug that the file's attribute had been set to read-only. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/GenFds/FvImageSection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BaseTools/Source/Python/GenFds/FvImageSection.py') diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/Python/GenFds/FvImageSection.py index 748d02f700..5989978a7c 100644 --- a/BaseTools/Source/Python/GenFds/FvImageSection.py +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py @@ -64,7 +64,7 @@ class FvImageSection(FvImageSectionClassObject): for FvFileName in FileList: FvAlignmentValue = 0 if os.path.isfile(FvFileName): - FvFileObj = open (FvFileName,'r+b') + FvFileObj = open (FvFileName,'rb') FvFileObj.seek(0) # PI FvHeader is 0x48 byte FvHeaderBuffer = FvFileObj.read(0x48) @@ -109,7 +109,7 @@ class FvImageSection(FvImageSectionClassObject): if self.FvFileName != None: FvFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvFileName) if os.path.isfile(FvFileName): - FvFileObj = open (FvFileName,'r+b') + FvFileObj = open (FvFileName,'rb') FvFileObj.seek(0) # PI FvHeader is 0x48 byte FvHeaderBuffer = FvFileObj.read(0x48) -- cgit v1.2.3