zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 8c90b05add807bdceb659aed6edba7e591f4e952 (tree)
parent 6d1b1374f722f2b6f6f91e181e831238e3c8ce00
Author: Vesim <vesim809@pm.me>
Date:   Mon, 27 Dec 2021 16:10:17 +0100

fchown: use the 32-bit uid/gid variant of the syscall on 32-bit linux targets

Diffstat:
Mlib/std/os/linux.zig | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig @@ -738,7 +738,11 @@ pub fn fchmod(fd: i32, mode: mode_t) usize { } pub fn fchown(fd: i32, owner: uid_t, group: gid_t) usize { - return syscall3(.fchown, @bitCast(usize, @as(isize, fd)), owner, group); + if (@hasField(SYS, "fchown32")) { + return syscall3(.fchown32, @bitCast(usize, @as(isize, fd)), owner, group); + } else { + return syscall3(.fchown, @bitCast(usize, @as(isize, fd)), owner, group); + } } /// Can only be called on 32 bit systems. For 64 bit see `lseek`.