src/server/util/util.c

changeset 56
c6cf20b09043
parent 47
ce9790523346
child 58
66c22e54aa90
--- a/src/server/util/util.c	Sun Mar 17 12:47:59 2013 +0100
+++ b/src/server/util/util.c	Sun Mar 17 17:54:20 2013 +0100
@@ -49,6 +49,8 @@
 
 
 //include "nspr.h"
+#include <errno.h>
+
 #include "../daemon/netsite.h"
 #include "../public/nsapi.h"
 
@@ -172,3 +174,20 @@
     return rv;
 }
 #endif
+
+
+NSAPI_PUBLIC int util_errno2status(int errno_value) {
+    switch(errno_value) {
+        case 0: {
+            return 200;
+        }
+        case EACCES: {
+            return 403;
+        }
+        case ENOENT: {
+            return 404;
+            break;
+        }
+    }
+    return 500;
+}

mercurial