src/s_conf: More detailed error messages conforming to POSIX errno
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 inf951460ae9
andf6f049070e
.
This commit is contained in:
parent
7ddd614cd3
commit
a576a0fe64
1 changed files with 18 additions and 1 deletions
19
src/s_conf.c
19
src/s_conf.c
|
@ -1350,6 +1350,8 @@ read_conf_files(int cold)
|
||||||
dont know anything else
|
dont know anything else
|
||||||
|
|
||||||
- Gozem 2002-07-21
|
- Gozem 2002-07-21
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
|
rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
|
||||||
|
|
||||||
|
@ -1357,8 +1359,23 @@ read_conf_files(int cold)
|
||||||
{
|
{
|
||||||
if(cold)
|
if(cold)
|
||||||
{
|
{
|
||||||
ilog(L_MAIN, "Failed in reading configuration file %s", filename);
|
|
||||||
inotice("Failed in reading configuration file %s, aborting", 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);
|
exit(-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue