commit d8bd0b28b1eba9833a55c68d6beaccb4d0604c88
parent 64d62c2b4ce43bd33461df8aaa6cbb08e8413888
Author: Ember Sawady <ecs@d2evs.net>
Date: Sat, 3 Jun 2023 05:43:36 +0000
fs+freebsd::readlink: return wrongtype on EINVAL
Signed-off-by: Ember Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/os/+freebsd/dirfdfs.ha b/os/+freebsd/dirfdfs.ha
@@ -271,7 +271,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;
};