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