]> jfr.im git - solanum.git/commitdiff
src/s_conf: More detailed error messages conforming to POSIX errno
authorQuora Dodrill <redacted>
Wed, 14 Aug 2013 22:26:29 +0000 (15:26 -0700)
committerQuora Dodrill <redacted>
Wed, 14 Aug 2013 22:30:15 +0000 (15:30 -0700)
When the configuration file is unreadable or not existing, charybdis will now report the POSIX error message from the failed call. This is a compromise between the behavior in f951460ae991e2e8defb9638f8ee508283705cbb and f6f049070e240d0ce637e9e3ac4fba4148b9725d.

src/s_conf.c

index 15e7006a1f7633db064280569098fe70fa786ef3..d3059e46f7e36e34db06102b0d51b6dd8d32e3ce 100644 (file)
@@ -1350,6 +1350,8 @@ read_conf_files(int cold)
           dont know anything else
 
           - Gozem 2002-07-21 
+
+
         */
        rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
 
@@ -1357,8 +1359,23 @@ read_conf_files(int cold)
        {
                if(cold)
                {
-                       ilog(L_MAIN, "Failed in reading configuration file %s", filename);
                        inotice("Failed in reading configuration file %s, aborting", filename);
+                       ilog(L_MAIN, "Failed in reading configuration file %s", filename);
+
+                       int e;
+                       e = errno;
+
+                       if (access(filename, F_OK) == -1) 
+                       {
+                               inotice("FATAL: %s %s", strerror(e), filename);
+                               ilog(L_MAIN, "FATAL: %s %s", strerror(e), filename);
+                       } 
+                       else if (access(filename, R_OK) == -1)
+                       {
+                               inotice("FATAL: %s %s", strerror(e), filename);
+                               ilog(L_MAIN, "FATAL: %s %s", strerror(e), filename);    
+                       }
+
                        exit(-1);
                }
                else