1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: make chmod() return error

This commit is contained in:
Alexander Medvednikov
2021-08-28 09:37:24 +03:00
parent 858ba25d55
commit 853d3cb83e
5 changed files with 6 additions and 6 deletions

View File

@ -886,9 +886,9 @@ pub fn flush() {
// chmod change file access attributes of `path` to `mode`.
// Octals like `0o600` can be used.
pub fn chmod(path string, mode int) {
pub fn chmod(path string, mode int)? {
if C.chmod(&char(path.str), mode) != 0 {
panic('chmod failed: ' + posix_get_error_msg(C.errno))
return error_with_code('chmod failed: ' + posix_get_error_msg(C.errno), C.errno)
}
}