e55890
? patch
e55890
? lib/isc/lex.c.rh490837
e55890
Index: lib/isc/lex.c
e55890
===================================================================
e55890
RCS file: /var/snap/bind9/lib/isc/lex.c,v
e55890
retrieving revision 1.86
e55890
diff -p -u -r1.86 lex.c
e55890
--- lib/isc/lex.c	17 Sep 2007 09:56:29 -0000	1.86
e55890
+++ lib/isc/lex.c	6 Apr 2009 13:24:15 -0000
e55890
@@ -425,17 +425,14 @@ isc_lex_gettoken(isc_lex_t *lex, unsigne
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
+
e55890
 					source->at_eof = ISC_TRUE;
e55890
 				}
e55890
 			} else {
e55890
Index: lib/isc/include/isc/stdio.h
e55890
===================================================================
e55890
RCS file: /var/snap/bind9/lib/isc/include/isc/stdio.h,v
e55890
retrieving revision 1.13
e55890
diff -p -u -r1.13 stdio.h
e55890
--- lib/isc/include/isc/stdio.h	19 Jun 2007 23:47:18 -0000	1.13
e55890
+++ lib/isc/include/isc/stdio.h	6 Apr 2009 13:24:15 -0000
e55890
@@ -72,6 +72,9 @@ isc_stdio_sync(FILE *f);
e55890
  * direct counterpart in the stdio library.
e55890
  */
e55890
 
e55890
+isc_result_t
e55890
+isc_stdio_fgetc(FILE *f, int *ret);
e55890
+
e55890
 ISC_LANG_ENDDECLS
e55890
 
e55890
 #endif /* ISC_STDIO_H */
e55890
Index: lib/isc/unix/errno2result.c
e55890
===================================================================
e55890
RCS file: /var/snap/bind9/lib/isc/unix/errno2result.c,v
e55890
retrieving revision 1.17
e55890
diff -p -u -r1.17 errno2result.c
e55890
--- lib/isc/unix/errno2result.c	19 Jun 2007 23:47:18 -0000	1.17
e55890
+++ lib/isc/unix/errno2result.c	6 Apr 2009 13:24:15 -0000
e55890
@@ -43,6 +43,7 @@ isc__errno2result(int posixerrno) {
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);
e55890
Index: lib/isc/unix/stdio.c
e55890
===================================================================
e55890
RCS file: /var/snap/bind9/lib/isc/unix/stdio.c,v
e55890
retrieving revision 1.8
e55890
diff -p -u -r1.8 stdio.c
e55890
--- lib/isc/unix/stdio.c	19 Jun 2007 23:47:18 -0000	1.8
e55890
+++ lib/isc/unix/stdio.c	6 Apr 2009 13:24:15 -0000
e55890
@@ -115,3 +115,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
+