hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit fbcc883147cfa8333f850672a23f181f82c007bb
parent 0eca26b7957a2602565278493fd4d2c3a1925919
Author: Ember Sawady <ecs@d2evs.net>
Date:   Mon, 23 Jan 2023 21:01:50 +0000

os::fs_create_file: add O_TRUNC by default

Fixes fs::move where the destination file is larger than the source file

Signed-off-by: Ember Sawady <ecs@d2evs.net>

Diffstat:
Mos/+linux/dirfdfs.ha | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha @@ -210,8 +210,8 @@ fn fs_create_file( flags: fs::flags... ) (io::file | fs::error) = { let oflags = 0; - if (len(flags) == 0z) { - oflags |= fs::flags::WRONLY; + if (len(flags) == 0) { + oflags |= fs::flags::WRONLY | fs::flags::TRUNC; }; for (let i = 0z; i < len(flags); i += 1z) { oflags |= flags[i]: int;