Add better error description in case a file could not be opened. - geomyidae - A small C-based gopherd.
Log
Files
Refs
README
LICENSE
---
commit 9a2203506973a803e74ffa80a27f2bf1919b68cc
parent 7b14b6e74778cf0ddb328cf3e049a302be614b36
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed,  4 Jan 2017 22:09:39 +0100

Add better error description in case a file could not be opened.

Diffstat:
  main.c                              |       5 +++++

1 file changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/main.c b/main.c
@@ -188,6 +188,11 @@ handlerequest(int sock, char *base, char *ohost, char *port, char *clienth,
                 }
         } else {
                 fd = open(path, O_RDONLY);
+                if(fd < 0) {
+                        if(loglvl & ERRORS)
+                                logentry(clienth, clientp, recvc, strerror(errno));
+                        return;
+                }
         }
 
         if(fd >= 0) {