summaryrefslogtreecommitdiff
path: root/apps/netutils/webserver/httpd_mmap.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-18 18:45:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-18 18:45:39 +0000
commit93ee8262f526db8d9b73dcb21b1a94054d5a064b (patch)
tree57e05816aff54967e701523653dd1dfd3155be7f /apps/netutils/webserver/httpd_mmap.c
parent9d045b959ec699d0bc459ed965e042a185307a37 (diff)
downloadpx4-nuttx-93ee8262f526db8d9b73dcb21b1a94054d5a064b.tar.gz
px4-nuttx-93ee8262f526db8d9b73dcb21b1a94054d5a064b.tar.bz2
px4-nuttx-93ee8262f526db8d9b73dcb21b1a94054d5a064b.zip
Add default file name if URL is a directory, giving index.html behavior. From Kate
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5162 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils/webserver/httpd_mmap.c')
-rw-r--r--apps/netutils/webserver/httpd_mmap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/netutils/webserver/httpd_mmap.c b/apps/netutils/webserver/httpd_mmap.c
index 9777df3b3..042c9932f 100644
--- a/apps/netutils/webserver/httpd_mmap.c
+++ b/apps/netutils/webserver/httpd_mmap.c
@@ -89,6 +89,18 @@ int httpd_mmap_open(const char *name, struct httpd_fs_file *file)
return ERROR;
}
+ if (S_ISDIR(st.st_mode))
+ {
+ errno = EISDIR;
+ return ERROR;
+ }
+
+ if (!S_ISREG(st.st_mode))
+ {
+ errno = ENOENT;
+ return ERROR;
+ }
+
if (st.st_size > INT_MAX)
{
errno = EFBIG;