1.1 --- a/libe2access/host/op_copy_in.c Sat Mar 19 00:41:11 2022 +0100
1.2 +++ b/libe2access/host/op_copy_in.c Sun Mar 20 00:17:21 2022 +0100
1.3 @@ -64,6 +64,11 @@
1.4 if (ext2fs_file_open(fs, ino_file, flags, &file))
1.5 return 1;
1.6
1.7 + /* Truncate the file, if overwriting. */
1.8 +
1.9 + if (!(flags & EXT2_FILE_CREATE))
1.10 + ext2fs_file_set_size2(file, 0);
1.11 +
1.12 /* Open the file in the source directory. */
1.13
1.14 fp = fopen(filename, "r");
1.15 @@ -146,7 +151,7 @@
1.16
1.17 /* Without a basename, the target exists and is either a directory, into
1.18 which the source file shall be copied, or it is a file that shall be
1.19 - overwritten. */
1.20 + overwritten (for which the basename is irrelevant). */
1.21
1.22 if (basename == NULL)
1.23 {