mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-06 21:51:30 +00:00
Fix CopyFile bug
Previously, helpers.CopyFile left off os.O_TRUNC, meaning that if the destination is larger than the source, the rest of the destination remained at the end. Now the file is overwritten completely. Signed-off-by: Kevin C. Wells <kevin.c.wells@intel.com>
This commit is contained in:
+2
-3
@@ -198,10 +198,9 @@ func UnpackFile(file string, dest string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CopyFile is used during the build process to copy a given file to the target
|
||||
// instead of dealing with the particulars of hardlinking.
|
||||
// CopyFile copies a file, overwriting the destination if it exists.
|
||||
func CopyFile(dest string, src string) error {
|
||||
return copyFileWithFlags(dest, src, os.O_RDWR|os.O_CREATE)
|
||||
return copyFileWithFlags(dest, src, os.O_RDWR|os.O_CREATE|os.O_TRUNC)
|
||||
}
|
||||
|
||||
// CopyFileNoOverwrite copies a file only if the destination file does not exist.
|
||||
|
||||
Reference in New Issue
Block a user