commit d7feeaaa2cb36ec05c70275a30afe17b1b9c9bfc (tree)
parent 2b29424efd05fb059ba35f16eb804613676c869d
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:
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`.