allocate writeFile and backupFile just once
This commit is contained in:
committed by
Jonathon Anderson
parent
983a359c00
commit
0bbab7ac3c
@@ -49,8 +49,8 @@ func Hostfile() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
if writeFile {
|
||||
err = overlay.CarefulWriteBuffer("/etc/hosts", buffer, backupFile, info.Mode())
|
||||
if *writeFile {
|
||||
err = overlay.CarefulWriteBuffer("/etc/hosts", buffer, *backupFile, info.Mode())
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not write file from template: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user