Function chown [src]
Changes the owner and group of the directory.
The process must have the correct privileges in order to do this
successfully. The group may be changed by the owner of the directory to
any group of which the owner is a member. Additionally, the directory
must have been opened with OpenOptions{ .iterate = true }. If the
owner or group is specified as null, the ID is not changed.
Prototype
pub fn chown(self: Dir, owner: ?File.Uid, group: ?File.Gid) ChownError!void
Parameters
self: Dir
owner: ?File.Uid
group: ?File.Gid
Possible Errors
The Operating System returned an undocumented error code.
This error is in theory not possible, but it would be better to handle this error than to invoke undefined behavior.
When this error code is observed, it usually means the Zig Standard Library needs a small patch to add the error code to the error set for the respective function.
Source
pub fn chown(self: Dir, owner: ?File.Uid, group: ?File.Gid) ChownError!void {
const file: File = .{ .handle = self.fd };
try file.chown(owner, group);
}