aboutsummaryrefslogtreecommitdiff
path: root/src/gb
diff options
context:
space:
mode:
authorskytrias <skytrias@protonmail.com>2021-10-23 00:12:32 +0200
committerskytrias <skytrias@protonmail.com>2021-10-23 00:12:32 +0200
commit6399f2b0146c4d91b948b09c2b180b42996fdb88 (patch)
tree9b365ca0a15dd2d1cf9598056835072fdbb5568e /src/gb
parent7218a68e894d765a6b30ed48f64d91740ce2b23e (diff)
fix strip-semicolon using original file handle size
Diffstat (limited to 'src/gb')
-rw-r--r--src/gb/gb.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gb/gb.h b/src/gb/gb.h
index 70e4d0ab0..f716b0840 100644
--- a/src/gb/gb.h
+++ b/src/gb/gb.h
@@ -6030,8 +6030,11 @@ gb_inline b32 gb_file_copy(char const *existing_filename, char const *new_filena
struct stat stat_existing;
fstat(existing_fd, &stat_existing);
-
size = sendfile(new_fd, existing_fd, 0, stat_existing.st_size);
+
+ // set new handle to wanted size for safety
+ int i = ftruncate(new_fd, size);
+ GB_ASSERT(i == 0);
close(new_fd);
close(existing_fd);