commit ecda8aa72217680be74305deebaba6c5173b72e8
parent 1849e53c71b71422a7f4b28a3a287ec7a772279e
Author: Umar Getagazov <umar@handlerug.me>
Date: Fri, 9 Jul 2021 00:01:44 +0700
fs::chmod: fix the permission mask
This commit also makes the code a bit more consistent.
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/fs.ha b/fs/fs.ha
@@ -30,7 +30,7 @@ export fn create(
mode: mode,
flags: flags...
) (*io::stream | error) = {
- mode = mode & 0o777;
+ mode &= 0o777;
return match (fs.create) {
null => errors::unsupported,
f: *createfunc => f(fs, path, mode, flags...),
@@ -179,8 +179,7 @@ export fn mksubdir(fs: *fs, path: str) (*fs | error) = {
// Changes mode flags on a file or directory. Type bits are discared.
export fn chmod(fs: *fs, path: str, mode: mode) (void | error) = {
- mode &= 0o755;
-
+ mode &= 0o777;
return match (fs.chmod) {
f: *chmodfunc => f(fs, path, mode),
null => errors::unsupported,