Skip to content

Commit 20ef802

Browse files
committed
Fix bug discovered by Liang. copy-file when target is existing file overwrites only a subset of the file.
1 parent e7c5909 commit 20ef802

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/core.stanza

+2-1
Original file line numberDiff line numberDiff line change
@@ -5732,8 +5732,9 @@ public defn SymLinkError (target:String, linkpath:String, msg:String) :
57325732

57335733
public defn copy-file (old-path:String, new-path:String) :
57345734
val old-file = RandomAccessFile(old-path, false)
5735-
val new-file = RandomAccessFile(new-path, true)
5735+
val new-file = RandomAccessFile(new-path, true)
57365736
try :
5737+
set-length(new-file, 0L)
57375738
val buffer = ByteArray(1042 * 1024)
57385739
val end = length(old-file)
57395740
while position(old-file) < end :

0 commit comments

Comments
 (0)