Skip to contentSkip to conversation

conffile: Don't give warning for optional config files.

PATCH In review NeilBrown 2 participants 2 messages Mar 27, 2020

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 conffile: Don't give warning for optional config files.

A recent commit added the possibility of optional config files for which warning messages would be suppressed.
Unfortunately only one of the possible warning messages - the least likely one - was suppressed.

This patch suppresses the other.

Fixes c6fdcbe0a5cf ("conffile: allow optional include files")
---
 support/nfs/conffile.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

That was careless - sorry. I really have tested this time. NeilBrown

support/nfs/conffile.c +3 -3
index d55bfe10120a..3d13610ee766 100644
@@ -429,9 +429,9 @@ conf_parse_line(int trans, char *line, const char *filename, int lineno, char **
 
 		subconf = conf_readfile(relpath);
 		if (subconf == NULL) {
-			xlog_warn("config error at %s:%d: "
-				"error loading included config",
-				  filename, lineno);
+			if (!optional)
+				xlog_warn("config error at %s:%d: error loading included config",
+					  filename, lineno);
 			if (relpath)
 				free(relpath);
 			return;
Signature · 1 line
2.25.2
#1 lore raw
Quoted 10 lines · NeilBrown

A recent commit added the possibility of optional config files for which warning messages would be suppressed.
Unfortunately only one of the possible warning messages - the least likely one - was suppressed.

This patch suppresses the other.

Fixes c6fdcbe0a5cf ("conffile: allow optional include files")

Committed... (tag: nfs-utils-2-4-4-rc2)

steved.

Quoted 26 lines
---
 support/nfs/conffile.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

That was careless - sorry. I really have tested this time. NeilBrown

support/nfs/conffile.c +3 -3
index d55bfe10120a..3d13610ee766 100644
@@ -429,9 +429,9 @@ conf_parse_line(int trans, char *line, const char *filename, int lineno, char **
 
 		subconf = conf_readfile(relpath);
 		if (subconf == NULL) {
-			xlog_warn("config error at %s:%d: "
-				"error loading included config",
-				  filename, lineno);
+			if (!optional)
+				xlog_warn("config error at %s:%d: error loading included config",
+					  filename, lineno);
 			if (relpath)
 				free(relpath);
 			return;