mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-07 04:10:35 +08:00
More M3 Wildfire logic; mmap-related bug fixes from Kate
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5124 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -95,6 +95,15 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
file->len = (int) st.st_size;
|
||||
|
||||
/* SUS3: "If len is zero, mmap() shall fail and no mapping shall be established." */
|
||||
|
||||
if (st.st_size == 0)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
file->fd = open(path, O_RDONLY);
|
||||
if (file->fd == -1)
|
||||
{
|
||||
@@ -108,13 +117,16 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
file->len = (int) st.st_size;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int httpd_mmap_close(struct httpd_fs_file *file)
|
||||
{
|
||||
if (file->len == 0)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FS_RAMMAP
|
||||
if (-1 == munmap(file->data, file->len))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user