ww build: honor Go output permission modes

This commit is contained in:
2026-08-20 22:03:09 +09:00
parent 77168fd891
commit 84f5e68709
8 changed files with 513 additions and 9 deletions

View File

@@ -302,8 +302,10 @@ export fn main(argc: i32, argv: **u8) i32 = {
return 1;
};
// Pinned Go's BuildInstallFunc creates an ordinary linked command with
// 0o777; open applies the invoking process's umask to this fresh stage.
let flags: os.flag = os.flag.WRONLY | os.flag.CREATE | os.flag.TRUNC;
let fd: i32 = os.open(pathstr(outpath), flags, 493i32); // 0o755
let fd: i32 = os.open(pathstr(outpath), flags, 511i32); // 0o777
if (fd < 0) {
let m: str = "w6l: cannot open output\n";
os.write(2, m.ptr, m.len: u64);