commit bc5ba82fe0e58d44cf89ffff81b3bf1b8795bb4a
parent 21cb0f78788cde4c80db288a081bb24605fdc161
Author: Alexey Yerin <yyp@disroot.org>
Date: Mon, 14 Jun 2021 16:51:05 +0300
fs: return errors::unsupported instead of abort()ing
Some functions were probably outdated and didn't return
errors::unsupported like others do. Crashing on unsupported operations
(1) makes assumptions about the underlying system, which is
unacceptable, and (2) prevents providing a fall-back implementation.
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fs.ha b/fs/fs.ha
@@ -151,7 +151,7 @@ export fn chmod(fs: *fs, path: str, mode: mode) (void | error) = {
return match (fs.chmod) {
f: *chmodfunc => f(fs, path, mode),
- null => abort(),
+ null => errors::unsupported,
};
};
@@ -159,7 +159,7 @@ export fn chmod(fs: *fs, path: str, mode: mode) (void | error) = {
export fn chown(fs: *fs, path: str, uid: uint, gid: uint) (void | error) = {
return match (fs.chown) {
f: *chownfunc => f(fs, path, uid, gid),
- null => abort(),
+ null => errors::unsupported,
};
};