Blame SOURCES/bind93-rh490837.patch

27025e
diff --git a/lib/isc/include/isc/stdio.h b/lib/isc/include/isc/stdio.h
27025e
index 1f44b5a..a3625f9 100644
27025e
--- a/lib/isc/include/isc/stdio.h
27025e
+++ b/lib/isc/include/isc/stdio.h
27025e
@@ -69,6 +69,9 @@ isc_stdio_sync(FILE *f);
27025e
  * direct counterpart in the stdio library.
27025e
  */
27025e
 
27025e
+isc_result_t
27025e
+isc_stdio_fgetc(FILE *f, int *ret);
27025e
+
27025e
 ISC_LANG_ENDDECLS
27025e
 
27025e
 #endif /* ISC_STDIO_H */
27025e
diff --git a/lib/isc/lex.c b/lib/isc/lex.c
27025e
index a8955bc..fc6103b 100644
27025e
--- a/lib/isc/lex.c
27025e
+++ b/lib/isc/lex.c
27025e
@@ -434,17 +434,14 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
e55890
 			if (source->is_file) {
e55890
 				stream = source->input;
e55890
 
e55890
-#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED)
e55890
-				c = getc_unlocked(stream);
e55890
-#else
e55890
-				c = getc(stream);
e55890
-#endif
e55890
-				if (c == EOF) {
e55890
-					if (ferror(stream)) {
e55890
-						source->result = ISC_R_IOERROR;
e55890
-						result = source->result;
e55890
+				result = isc_stdio_fgetc(stream, &c);
e55890
+
e55890
+				if (result != ISC_R_SUCCESS) {
e55890
+					if (result != ISC_R_EOF) {
e55890
+						source->result = result;
e55890
 						goto done;
e55890
 					}
e55890
+
27025e
 					source->at_eof = true;
e55890
 				}
e55890
 			} else {
27025e
diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c
27025e
index 2f12bcc..5bfd648 100644
27025e
--- a/lib/isc/unix/errno2result.c
27025e
+++ b/lib/isc/unix/errno2result.c
27025e
@@ -40,6 +40,7 @@ isc___errno2result(int posixerrno, bool dolog,
e55890
 	case EINVAL:		/* XXX sometimes this is not for files */
e55890
 	case ENAMETOOLONG:
e55890
 	case EBADF:
e55890
+	case EISDIR:
e55890
 		return (ISC_R_INVALIDFILE);
e55890
 	case ENOENT:
e55890
 		return (ISC_R_FILENOTFOUND);
27025e
diff --git a/lib/isc/unix/stdio.c b/lib/isc/unix/stdio.c
27025e
index e60fa65..77f0b13 100644
27025e
--- a/lib/isc/unix/stdio.c
27025e
+++ b/lib/isc/unix/stdio.c
27025e
@@ -149,3 +149,22 @@ isc_stdio_sync(FILE *f) {
e55890
 		return (isc__errno2result(errno));
e55890
 }
e55890
 
e55890
+isc_result_t
e55890
+isc_stdio_fgetc(FILE *f, int *ret) {
e55890
+	int r;
e55890
+	isc_result_t result = ISC_R_SUCCESS;
e55890
+
e55890
+#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED)
e55890
+	r = fgetc_unlocked(f);
e55890
+#else
e55890
+	r = fgets(f);
e55890
+#endif
e55890
+
e55890
+	if (r == EOF)
e55890
+		result = ferror(f) ? isc__errno2result(errno) : ISC_R_EOF;
e55890
+
e55890
+	*ret = r;
e55890
+
e55890
+	return result;
e55890
+}
e55890
+