diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c index 23e6ceb330d..6057ef7affe 100644 --- a/fs/mmap/fs_rammap.c +++ b/fs/mmap/fs_rammap.c @@ -161,12 +161,8 @@ FAR void *rammap(int fd, size_t length, off_t offset) fpos = lseek(fd, offset, SEEK_SET); if (fpos == (off_t)-1) { - /* Seek failed... errno has already been set, but EINVAL is probably - * the correct response. - */ - ferr("ERROR: Seek to position %d failed\n", (int)offset); - errcode = EINVAL; + errcode = get_errno(); goto errout_with_region; }