Adam Tkac 3475d4
? patch
Adam Tkac 3475d4
? lib/isc/lex.c.rh490837
Adam Tkac 3475d4
Index: lib/isc/lex.c
Adam Tkac 3475d4
===================================================================
Adam Tkac 3475d4
RCS file: /var/snap/bind9/lib/isc/lex.c,v
Adam Tkac 3475d4
retrieving revision 1.86
Adam Tkac 3475d4
diff -p -u -r1.86 lex.c
Adam Tkac 3475d4
--- lib/isc/lex.c	17 Sep 2007 09:56:29 -0000	1.86
Adam Tkac 3475d4
+++ lib/isc/lex.c	6 Apr 2009 13:24:15 -0000
Adam Tkac 3475d4
@@ -425,17 +425,14 @@ isc_lex_gettoken(isc_lex_t *lex, unsigne
Adam Tkac 3475d4
 			if (source->is_file) {
Adam Tkac 3475d4
 				stream = source->input;
Adam Tkac 3475d4
 
Adam Tkac 3475d4
-#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED)
Adam Tkac 3475d4
-				c = getc_unlocked(stream);
Adam Tkac 3475d4
-#else
Adam Tkac 3475d4
-				c = getc(stream);
Adam Tkac 3475d4
-#endif
Adam Tkac 3475d4
-				if (c == EOF) {
Adam Tkac 3475d4
-					if (ferror(stream)) {
Adam Tkac 3475d4
-						source->result = ISC_R_IOERROR;
Adam Tkac 3475d4
-						result = source->result;
Adam Tkac 3475d4
+				result = isc_stdio_fgetc(stream, &c);
Adam Tkac 3475d4
+
Adam Tkac 3475d4
+				if (result != ISC_R_SUCCESS) {
Adam Tkac 3475d4
+					if (result != ISC_R_EOF) {
Adam Tkac 3475d4
+						source->result = result;
Adam Tkac 3475d4
 						goto done;
Adam Tkac 3475d4
 					}
Adam Tkac 3475d4
+
Adam Tkac 3475d4
 					source->at_eof = ISC_TRUE;
Adam Tkac 3475d4
 				}
Adam Tkac 3475d4
 			} else {
Adam Tkac 3475d4
Index: lib/isc/include/isc/stdio.h
Adam Tkac 3475d4
===================================================================
Adam Tkac 3475d4
RCS file: /var/snap/bind9/lib/isc/include/isc/stdio.h,v
Adam Tkac 3475d4
retrieving revision 1.13
Adam Tkac 3475d4
diff -p -u -r1.13 stdio.h
Adam Tkac 3475d4
--- lib/isc/include/isc/stdio.h	19 Jun 2007 23:47:18 -0000	1.13
Adam Tkac 3475d4
+++ lib/isc/include/isc/stdio.h	6 Apr 2009 13:24:15 -0000
Adam Tkac 3475d4
@@ -72,6 +72,9 @@ isc_stdio_sync(FILE *f);
Adam Tkac 3475d4
  * direct counterpart in the stdio library.
Adam Tkac 3475d4
  */
Adam Tkac 3475d4
 
Adam Tkac 3475d4
+isc_result_t
Adam Tkac 3475d4
+isc_stdio_fgetc(FILE *f, int *ret);
Adam Tkac 3475d4
+
Adam Tkac 3475d4
 ISC_LANG_ENDDECLS
Adam Tkac 3475d4
 
Adam Tkac 3475d4
 #endif /* ISC_STDIO_H */
Adam Tkac 3475d4
Index: lib/isc/unix/errno2result.c
Adam Tkac 3475d4
===================================================================
Adam Tkac 3475d4
RCS file: /var/snap/bind9/lib/isc/unix/errno2result.c,v
Adam Tkac 3475d4
retrieving revision 1.17
Adam Tkac 3475d4
diff -p -u -r1.17 errno2result.c
Adam Tkac 3475d4
--- lib/isc/unix/errno2result.c	19 Jun 2007 23:47:18 -0000	1.17
Adam Tkac 3475d4
+++ lib/isc/unix/errno2result.c	6 Apr 2009 13:24:15 -0000
Adam Tkac 3475d4
@@ -43,6 +43,7 @@ isc__errno2result(int posixerrno) {
Adam Tkac 3475d4
 	case EINVAL:		/* XXX sometimes this is not for files */
Adam Tkac 3475d4
 	case ENAMETOOLONG:
Adam Tkac 3475d4
 	case EBADF:
Adam Tkac 3475d4
+	case EISDIR:
Adam Tkac 3475d4
 		return (ISC_R_INVALIDFILE);
Adam Tkac 3475d4
 	case ENOENT:
Adam Tkac 3475d4
 		return (ISC_R_FILENOTFOUND);
Adam Tkac 3475d4
Index: lib/isc/unix/stdio.c
Adam Tkac 3475d4
===================================================================
Adam Tkac 3475d4
RCS file: /var/snap/bind9/lib/isc/unix/stdio.c,v
Adam Tkac 3475d4
retrieving revision 1.8
Adam Tkac 3475d4
diff -p -u -r1.8 stdio.c
Adam Tkac 3475d4
--- lib/isc/unix/stdio.c	19 Jun 2007 23:47:18 -0000	1.8
Adam Tkac 3475d4
+++ lib/isc/unix/stdio.c	6 Apr 2009 13:24:15 -0000
Adam Tkac 3475d4
@@ -115,3 +115,22 @@ isc_stdio_sync(FILE *f) {
Adam Tkac 3475d4
 		return (isc__errno2result(errno));
Adam Tkac 3475d4
 }
Adam Tkac 3475d4
 
Adam Tkac 3475d4
+isc_result_t
Adam Tkac 3475d4
+isc_stdio_fgetc(FILE *f, int *ret) {
Adam Tkac 3475d4
+	int r;
Adam Tkac 3475d4
+	isc_result_t result = ISC_R_SUCCESS;
Adam Tkac 3475d4
+
Adam Tkac 3475d4
+#if defined(HAVE_FLOCKFILE) && defined(HAVE_GETCUNLOCKED)
Adam Tkac 3475d4
+	r = fgetc_unlocked(f);
Adam Tkac 3475d4
+#else
Adam Tkac 3475d4
+	r = fgets(f);
Adam Tkac 3475d4
+#endif
Adam Tkac 3475d4
+
Adam Tkac 3475d4
+	if (r == EOF)
Adam Tkac 3475d4
+		result = ferror(f) ? isc__errno2result(errno) : ISC_R_EOF;
Adam Tkac 3475d4
+
Adam Tkac 3475d4
+	*ret = r;
Adam Tkac 3475d4
+
Adam Tkac 3475d4
+	return result;
Adam Tkac 3475d4
+}
Adam Tkac 3475d4
+