Function chown [src]

Changes the owner and group of the file. The process must have the correct privileges in order to do this successfully. The group may be changed by the owner of the file to any group of which the owner is a member. If the owner or group is specified as null, the ID is not changed.

Prototype

pub fn chown(self: File, owner: ?Uid, group: ?Gid) ChownError!void

Parameters

self: Fileowner: ?Uidgroup: ?Gid

Possible Errors

AccessDenied FChownError
FileNotFound FChownError
InputOutput FChownError
PermissionDenied FChownError
ReadOnlyFileSystem FChownError
SymLinkLoop FChownError
SystemResources FChownError
Unexpected UnexpectedError

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: File, owner: ?Uid, group: ?Gid) ChownError!void { try posix.fchown(self.handle, owner, group); }