More M3 Wildfire logic; mmap-related bug fixes from Kate
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5124 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
5d59ee57b5
commit
b6b035f8df
@ -314,3 +314,6 @@
|
|||||||
error handling: Now the number of arguments to mount can be 0 or 4.
|
error handling: Now the number of arguments to mount can be 0 or 4.
|
||||||
Additional parameter checking is required to prevent mysterious errors
|
Additional parameter checking is required to prevent mysterious errors
|
||||||
(submiteed by Kate).
|
(submiteed by Kate).
|
||||||
|
* apps/netutils/webserver/httpd_mmap.c: Fix errors when the mmap()
|
||||||
|
length is zero (submitted by Kate).
|
||||||
|
|
||||||
|
@ -95,6 +95,15 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
|
|||||||
return ERROR;
|
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);
|
file->fd = open(path, O_RDONLY);
|
||||||
if (file->fd == -1)
|
if (file->fd == -1)
|
||||||
{
|
{
|
||||||
@ -108,13 +117,16 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
file->len = (int) st.st_size;
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int httpd_mmap_close(struct httpd_fs_file *file)
|
int httpd_mmap_close(struct httpd_fs_file *file)
|
||||||
{
|
{
|
||||||
|
if (file->len == 0)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FS_RAMMAP
|
#ifdef CONFIG_FS_RAMMAP
|
||||||
if (-1 == munmap(file->data, file->len))
|
if (-1 == munmap(file->data, file->len))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user