From d8c8722f28ca439b9ca46f109e2804a7eb33a1ac Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Fri, 7 Jul 2000 18:58:46 +0000 Subject: [PATCH] 313. [bug] When parsing resolv.conf, don't terminate on an error. Instead, parse as much as possible, but still return an error if one was found. --- CHANGES | 4 ++++ lib/lwres/include/lwres/lwres.h | 5 +++-- lib/lwres/lwconfig.c | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index dc30e11f46..b7d4da53d8 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ + 313. [bug] When parsing resolv.conf, don't terminate on an + error. Instead, parse as much as possible, but + still return an error if one was found. + 312. [bug] Increase the number of allowed elements in the resolv.conf search path from 6 to 8. If there are more than this, ignore the remainder rather diff --git a/lib/lwres/include/lwres/lwres.h b/lib/lwres/include/lwres/lwres.h index d00e82ae99..17fcda7b24 100644 --- a/lib/lwres/include/lwres/lwres.h +++ b/lib/lwres/include/lwres/lwres.h @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: lwres.h,v 1.40 2000/07/07 18:24:11 bwelling Exp $ */ +/* $Id: lwres.h,v 1.41 2000/07/07 18:58:45 bwelling Exp $ */ #ifndef LWRES_LWRES_H #define LWRES_LWRES_H 1 @@ -423,7 +423,8 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename); * * Returns: * LWRES_R_SUCCESS on a successful parse. - * Anything else on error. + * Anything else on error, although the structure may be partially filled + * in. */ lwres_result_t diff --git a/lib/lwres/lwconfig.c b/lib/lwres/lwconfig.c index 25fd35d4d0..79d775497b 100644 --- a/lib/lwres/lwconfig.c +++ b/lib/lwres/lwconfig.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: lwconfig.c,v 1.21 2000/07/07 18:28:58 bwelling Exp $ */ +/* $Id: lwconfig.c,v 1.22 2000/07/07 18:58:46 bwelling Exp $ */ /*** *** Module for parsing resolv.conf files. @@ -517,7 +517,7 @@ lwres_result_t lwres_conf_parse(lwres_context_t *ctx, const char *filename) { FILE *fp = NULL; char word[256]; - lwres_result_t rval; + lwres_result_t rval, ret; lwres_conf_t *confdata; int stopchar; @@ -532,6 +532,7 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) { if ((fp = fopen(filename, "r")) == NULL) return (LWRES_R_FAILURE); + ret = LWRES_R_SUCCESS; do { stopchar = getword(fp, word, sizeof(word)); if (stopchar == EOF) { @@ -559,11 +560,13 @@ lwres_conf_parse(lwres_context_t *ctx, const char *filename) { break; } } - } while (rval == LWRES_R_SUCCESS); + if (ret == LWRES_R_SUCCESS && rval != LWRES_R_SUCCESS) + ret = rval; + } while (1); fclose(fp); - return (rval); + return (ret); } lwres_result_t