diff options
Diffstat (limited to 'examples/fileserver.c')
| -rw-r--r-- | examples/fileserver.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/fileserver.c b/examples/fileserver.c index 92d344c..954c985 100644 --- a/examples/fileserver.c +++ b/examples/fileserver.c @@ -185,11 +185,11 @@ int request_handler(struct uvh_request *req) uv_fs_t stat_req; uv_fs_stat(uv_default_loop(), &stat_req, real_path, NULL); - if (S_ISDIR(stat_req.statbuf.st_mode)) + if (stat_req.result != -1 && S_ISDIR(stat_req.statbuf.st_mode)) { handle_dir(req, req_path, real_path); } - else if (S_ISREG(stat_req.statbuf.st_mode)) + else if (stat_req.result != -1 && S_ISREG(stat_req.statbuf.st_mode)) { handle_file(req, req_path, real_path); } |
