diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-10 20:00:04 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-10 20:00:04 +0000 |
commit | c0e51eccc5bc5ce6743572f97cfc9d13fc13ceab (patch) | |
tree | 416516f21abef14bf01587a6f93c6b02ac369255 /apps/netutils/webserver | |
parent | 4f03177a72a65beeca2e40185d2e2fa97f24bc11 (diff) | |
download | nuttx-c0e51eccc5bc5ce6743572f97cfc9d13fc13ceab.tar.gz nuttx-c0e51eccc5bc5ce6743572f97cfc9d13fc13ceab.tar.bz2 nuttx-c0e51eccc5bc5ce6743572f97cfc9d13fc13ceab.zip |
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
Diffstat (limited to 'apps/netutils/webserver')
-rw-r--r-- | apps/netutils/webserver/httpd_mmap.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/netutils/webserver/httpd_mmap.c b/apps/netutils/webserver/httpd_mmap.c index 301168a09..9777df3b3 100644 --- a/apps/netutils/webserver/httpd_mmap.c +++ b/apps/netutils/webserver/httpd_mmap.c @@ -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)) { |