logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 23c6c6b5d41a68f56d1ba99645c09b842da3815c
parent e26daacb4cacca1d7f5e4166a8b80a55da7c7724
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 16 Dec 2024 22:25:32 +0100

cmd/truncate: add mode flags to open(2) call

Diffstat:

Mcmd/truncate.c3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd/truncate.c b/cmd/truncate.c @@ -116,7 +116,8 @@ main(int argc, char *argv[]) assert(errno == 0); char *arg = argv[argi]; - int fd = open(arg, open_flags); + // same flags to open as touch(1) + int fd = open(arg, open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if(fd < 0) { fprintf(stderr, "truncate: error: Failed to open '%s': %s\n", arg, strerror(errno));