commit 0650341725382046212753b715113b323b10fc23
parent a79fc48efa90b70394959db471c4082481568aac
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 7 Jan 2022 12:57:33 +0100
dirfdfs: swap EINVAL for fs::wrongtype on readlink
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha
@@ -296,7 +296,12 @@ fn fs_readlink(fs: *fs::fs, path: str) (str | fs::error) = {
static let buf: [rt::PATH_MAX]u8 = [0...];
let z = match (rt::readlinkat(fs.dirfd, path, buf[..])) {
case let err: rt::errno =>
- return errno_to_fs(err);
+ switch (err) {
+ case rt::EINVAL =>
+ return fs::wrongtype;
+ case =>
+ return errno_to_fs(err);
+ };
case let z: size =>
yield z;
};