Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > f8342e86bff6d297166a52de551bf989 > files > 28

bind-9.10.2.P2-1.mga5.src.rpm

diff -Naurp bind-9.9.5/lib/isc/include/isc/stdio.h bind-9.9.5.oden/lib/isc/include/isc/stdio.h
--- bind-9.9.5/lib/isc/include/isc/stdio.h	2014-01-27 19:58:24.000000000 +0100
+++ bind-9.9.5.oden/lib/isc/include/isc/stdio.h	2014-02-02 14:02:53.151258659 +0100
@@ -76,6 +76,9 @@ isc_stdio_sync(FILE *f);
  * direct counterpart in the stdio library.
  */
 
+isc_result_t
+isc_stdio_fgetc(FILE *f, int *ret);
+
 ISC_LANG_ENDDECLS
 
 #endif /* ISC_STDIO_H */
diff -Naurp bind-9.9.5/lib/isc/lex.c bind-9.9.5.oden/lib/isc/lex.c
--- bind-9.9.5/lib/isc/lex.c	2014-01-27 19:58:24.000000000 +0100
+++ bind-9.9.5.oden/lib/isc/lex.c	2014-02-02 14:02:53.151258659 +0100
@@ -425,17 +425,14 @@ isc_lex_gettoken(isc_lex_t *lex, unsigne
 			if (source->is_file) {
 				stream = source->input;
 
-#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED)
-				c = getc_unlocked(stream);
-#else
-				c = getc(stream);
-#endif
-				if (c == EOF) {
-					if (ferror(stream)) {
-						source->result = ISC_R_IOERROR;
-						result = source->result;
+				result = isc_stdio_fgetc(stream, &c);
+
+				if (result != ISC_R_SUCCESS) {
+					if (result != ISC_R_EOF) {
+						source->result = result;
 						goto done;
 					}
+
 					source->at_eof = ISC_TRUE;
 				}
 			} else {
diff -Naurp bind-9.9.5/lib/isc/unix/errno2result.c bind-9.9.5.oden/lib/isc/unix/errno2result.c
--- bind-9.9.5/lib/isc/unix/errno2result.c	2014-01-27 19:58:24.000000000 +0100
+++ bind-9.9.5.oden/lib/isc/unix/errno2result.c	2014-02-02 14:02:53.152258659 +0100
@@ -43,6 +43,7 @@ isc___errno2result(int posixerrno, const
 	case EINVAL:		/* XXX sometimes this is not for files */
 	case ENAMETOOLONG:
 	case EBADF:
+	case EISDIR:
 		return (ISC_R_INVALIDFILE);
 	case ENOENT:
 		return (ISC_R_FILENOTFOUND);
diff -Naurp bind-9.9.5/lib/isc/unix/stdio.c bind-9.9.5.oden/lib/isc/unix/stdio.c
--- bind-9.9.5/lib/isc/unix/stdio.c	2014-01-27 19:58:24.000000000 +0100
+++ bind-9.9.5.oden/lib/isc/unix/stdio.c	2014-02-02 14:02:53.152258659 +0100
@@ -142,3 +142,22 @@ isc_stdio_sync(FILE *f) {
 		return (isc__errno2result(errno));
 }
 
+isc_result_t
+isc_stdio_fgetc(FILE *f, int *ret) {
+	int r;
+	isc_result_t result = ISC_R_SUCCESS;
+
+#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED)
+	r = fgetc_unlocked(f);
+#else
+	r = fgets(f);
+#endif
+
+	if (r == EOF)
+		result = ferror(f) ? isc__errno2result(errno) : ISC_R_EOF;
+
+	*ret = r;
+
+	return result;
+}
+