fchownat: fix behavior for uid == -1 && gid == -1

Previously, this would error with EINVAL since the conversion to
unsigned int would fail on -1. Now, we do a bitwise conversion via
an `as` cast.
This commit is contained in:
Connor-GH
2026-04-29 15:23:56 -05:00
parent 861bbb024a
commit 22faf6b615
+1 -5
View File
@@ -333,11 +333,7 @@ impl Pal for Sys {
}
let path = path.to_str().map_err(|_| Errno(EINVAL))?;
let file = openat2(fildes, path, flags, 0)?;
libredox::fchown(
*file as usize,
owner.try_into().map_err(|_| Errno(EINVAL))?,
group.try_into().map_err(|_| Errno(EINVAL))?,
)?;
libredox::fchown(*file as usize, owner as _, group as _)?;
Ok(())
}