aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/config/operation.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-04-11 14:39:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-04-11 14:39:31 +0200
commitd6e9703edbd28508882fab3ce698617d036abfdd (patch)
treeef544027338453bdd783996bca7856ed65ccc1e9 /libbuild2/config/operation.cxx
parent87a7253a3bd82b59063172f3799b0a5587e7b2a5 (diff)
Diagnose empty paths in config.config.{load,save}
GitHub issue #372.
Diffstat (limited to 'libbuild2/config/operation.cxx')
-rw-r--r--libbuild2/config/operation.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/libbuild2/config/operation.cxx b/libbuild2/config/operation.cxx
index 5983e4b..150bf1a 100644
--- a/libbuild2/config/operation.cxx
+++ b/libbuild2/config/operation.cxx
@@ -759,6 +759,11 @@ namespace build2
lookup l (rs[*c_s]);
if (l && (l.belongs (rs) || l.belongs (ctx.global_scope)))
{
+ const path& f (cast<path> (l));
+
+ if (f.empty ())
+ fail << "empty path in " << *c_s;
+
// While writing the complete configuration seems like a natural
// default, there might be a desire to take inheritance into
// account (if, say, we are exporting at multiple levels). One can
@@ -766,8 +771,7 @@ namespace build2
// still want to support this mode somehow in the future (it seems
// like an override of config.config.persist should do the trick).
//
- save_config (
- rs, cast<path> (l), false /* inherit */, mod, projects);
+ save_config (rs, f, false /* inherit */, mod, projects);
}
}
}