fs/mmap: fix mmap() wrong errno

As posix spec, mmap() function shall fail with ENODEV if fd refers
to a file whose type is not supported. Change to pass ltp open_posix test:
testcases/open_posix_testsuite/conformance/interfaces/mmap/23-1.c

https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
fangxinyong 2023-06-10 00:41:52 +08:00 committed by Xiang Xiao
parent 5176fb917a
commit d892cda167
1 changed files with 2 additions and 2 deletions

View File

@ -269,8 +269,8 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags,
if (fd != -1 && fs_getfilep(fd, &filep) < 0)
{
ferr("ERROR: Invalid file descriptor, fd=%d\n", fd);
ret = -EBADF;
ferr("ERROR: fd:%d referred file whose type is not supported\n", fd);
ret = -ENODEV;
goto errout;
}