yocto-bsp: have replace_file() close file before copying

replace_file needs to make sure the file it's replacing is closed
before replacing it, otherwise unexpected results may ensue.

Fixes [YOCTO #4145].

(From meta-yocto rev: 1339dbb690d51456b4474356992e430638469e47)

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tom Zanussi
2013-03-29 16:48:50 -05:00
committed by Richard Purdie
parent fd67cfd1c5
commit df1ad143c3

View File

@@ -571,7 +571,8 @@ def replace_file(replace_this, with_this):
the original filename.
"""
try:
shutil.copy(with_this, replace_this)
replace_this.close()
shutil.copy(with_this, replace_this.name)
except IOError:
pass