diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2014-05-29 15:35:00 +0300 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2014-05-29 15:35:00 +0300 |
| commit | 78156ded91e69b95493949a9ba4895e193adebad (patch) | |
| tree | 2a513f96c343bd30428a6fb6eafdd2da5e231b76 | |
| parent | 645b43c2333d9abaea0299575beed965913bc75f (diff) | |
| download | libuvh-78156ded91e69b95493949a9ba4895e193adebad.tar.gz libuvh-78156ded91e69b95493949a9ba4895e193adebad.zip | |
fileserver: check stat result code
| -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); } |
