Procházet zdrojové kódy

Resolve #184: when using include_dir, accrue any non-zero statuses,
but don't exit the function until all files have been read.

madlohe před 6 roky
rodič
revize
a1c89bee8d
2 změnil soubory, kde provedl 3 přidání a 11 odebrání
  1. 1 0
      CHANGELOG.md
  2. 2 11
      src/nrpe.c

+ 1 - 0
CHANGELOG.md

@@ -22,6 +22,7 @@ to check_nrpe to continue using the old protocol.
 * nasty_metachars will now handle C escape sequences properly when specified in the config file (Sebastian Wolf)
 * Calculated packet sizes now struct padding/alignment when sending and receiving messages (Sebastian Wolf)
 * Buffer sizes are now checked before use in packet size calculation (Sebastian Wolf)
+* When using `include_dir`, individual files' errors do not prevent the remaining files from being read (Sebastian Wolf)
 
 
 [3.2.1](https://github.com/NagiosEnterprises/nrpe/releases/tag/nrpe-3.2.1) - 2017-08-31

+ 2 - 11
src/nrpe.c

@@ -1161,11 +1161,7 @@ int read_config_dir(char *dirname)
 				continue;
 
 			/* process the config file */
-			result = read_config_file(config_file);
-
-			/* break out if we encountered an error */
-			if (result == ERROR)
-				break;
+			result |= read_config_file(config_file);
 		}
 
 		/* recurse into subdirectories... */
@@ -1176,12 +1172,7 @@ int read_config_dir(char *dirname)
 				continue;
 
 			/* process the config directory */
-			result = read_config_dir(config_file);
-
-			/* break out if we encountered an error */
-			if (result == ERROR)
-				break;
-
+			result |= read_config_dir(config_file);
 		}
 	}