Merge "Fix multiple copies of read-only files in sbox" am: 85920c9389
am: 2d4d403560
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1660771 Change-Id: I5739ebbc68a07848605f33634f22f5c7f0b2afb8
This commit is contained in:
commit
0295902294
|
@ -387,6 +387,14 @@ func copyOneFile(from string, to string, executable bool) error {
|
||||||
}
|
}
|
||||||
defer in.Close()
|
defer in.Close()
|
||||||
|
|
||||||
|
// Remove the target before copying. In most cases the file won't exist, but if there are
|
||||||
|
// duplicate copy rules for a file and the source file was read-only the second copy could
|
||||||
|
// fail.
|
||||||
|
err = os.Remove(to)
|
||||||
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
out, err := os.Create(to)
|
out, err := os.Create(to)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue