Improve error message when directory name is given
Surprising error IO error is returned when directory name is given instead of named.conf file. It can be passed to named-checkconf or include statement. Make a simple change to return Invalid file instead. Still not precise, but much better error message is returned. Fix of rhbz#490837.
This commit is contained in:
committed by
Matthijs Mekking
parent
a181b556f0
commit
929bbe192d
@@ -37,6 +37,8 @@ isc___errno2result(int posixerrno, bool dolog, const char *file,
|
||||
case ENAMETOOLONG:
|
||||
case EBADF:
|
||||
return (ISC_R_INVALIDFILE);
|
||||
case EISDIR:
|
||||
return (ISC_R_NOTFILE);
|
||||
case ENOENT:
|
||||
return (ISC_R_FILENOTFOUND);
|
||||
case EACCES:
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include "errno2result.h"
|
||||
|
||||
typedef struct inputsource {
|
||||
isc_result_t result;
|
||||
bool is_file;
|
||||
@@ -425,7 +427,9 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
|
||||
#endif /* if defined(HAVE_FLOCKFILE) && defined(HAVE_GETC_UNLOCKED) */
|
||||
if (c == EOF) {
|
||||
if (ferror(stream)) {
|
||||
source->result = ISC_R_IOERROR;
|
||||
source->result =
|
||||
isc__errno2result(
|
||||
errno);
|
||||
result = source->result;
|
||||
goto done;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user