mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
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:
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user