mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 07:46:16 +08:00
fs/mmap/fs_mmap.c: fix errno when fd is not valid
mmap() should return EBADF errno when fd is not valid. We can just return error code from file_get(). Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
committed by
Matteo Golin
parent
0c9d0b3f84
commit
20c9ff679c
+2
-3
@@ -287,10 +287,9 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags,
|
||||
FAR void *mapped = NULL;
|
||||
int ret;
|
||||
|
||||
if (fd != -1 && file_get(fd, &filep) < 0)
|
||||
if (fd != -1 && (ret = file_get(fd, &filep)) < 0)
|
||||
{
|
||||
ferr("ERROR: fd:%d referred file whose type is not supported\n", fd);
|
||||
ret = -ENODEV;
|
||||
ferr("ERROR: fd:%d referred file is not valid\n", fd);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user