| ? patch |
| ? lib/isc/lex.c.rh490837 |
| |
| |
| RCS file: /var/snap/bind9/lib/isc/lex.c,v |
| retrieving revision 1.86 |
| diff -p -u -r1.86 lex.c |
| |
| |
| @@ -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 { |
| |
| |
| RCS file: /var/snap/bind9/lib/isc/include/isc/stdio.h,v |
| retrieving revision 1.13 |
| diff -p -u -r1.13 stdio.h |
| |
| |
| @@ -72,6 +72,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 */ |
| |
| |
| RCS file: /var/snap/bind9/lib/isc/unix/errno2result.c,v |
| retrieving revision 1.17 |
| diff -p -u -r1.17 errno2result.c |
| |
| |
| @@ -43,6 +43,7 @@ isc__errno2result(int posixerrno) { |
| 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); |
| |
| |
| RCS file: /var/snap/bind9/lib/isc/unix/stdio.c,v |
| retrieving revision 1.8 |
| diff -p -u -r1.8 stdio.c |
| |
| |
| @@ -115,3 +115,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; |
| +} |
| + |