Function chmod [src]

Changes the mode of the file. The process must have the correct privileges in order to do this successfully, or must have the effective user ID matching the owner of the file.

Prototype

pub fn chmod(self: File, new_mode: Mode) ChmodError!void

Parameters

self: Filenew_mode: Mode

Possible Errors

AccessDenied FChmodError
FileNotFound FChmodError
InputOutput FChmodError
PermissionDenied FChmodError
ReadOnlyFileSystem FChmodError
SymLinkLoop FChmodError
SystemResources FChmodError
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 chmod(self: File, new_mode: Mode) ChmodError!void { try posix.fchmod(self.handle, new_mode); }