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