summaryrefslogtreecommitdiff
path: root/hscript/meta.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-14 12:43:26 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-14 12:43:26 -0500
commit88378c535e0191dd6c8a03759f333f39550fc983 (patch)
tree6bdc660aa7101248a130ce94d4edc26c82d48ddd /hscript/meta.cc
parent036eb19b5825cbcd111420032e6291a10384a275 (diff)
downloadhorizon-88378c535e0191dd6c8a03759f333f39550fc983.tar.gz
horizon-88378c535e0191dd6c8a03759f333f39550fc983.tar.bz2
horizon-88378c535e0191dd6c8a03759f333f39550fc983.tar.xz
horizon-88378c535e0191dd6c8a03759f333f39550fc983.zip
hscript: Assert instead of validate in Hostname::execute
Diffstat (limited to 'hscript/meta.cc')
-rw-r--r--hscript/meta.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc
index 4d051f4..e1f7b2f 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -10,6 +10,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+#include <assert.h>
#include <fstream>
#include <regex>
#include <unistd.h>
@@ -75,12 +76,7 @@ bool Hostname::execute(ScriptOptions opts) const {
/* Linux has a nodename limit of 64 characters.
* That's fine, because we have a limit of 64 chars per segment.
* Assuming a dot is present, just chop at the first dot. */
- if(dot == std::string::npos || dot >= 64) {
- output_error("installfile:" + std::to_string(this->lineno()),
- "hostname: nodename too long",
- "Linux requires nodename to be <= 64 characters.");
- return false;
- }
+ assert(dot <= 64);
actual = this->_value.substr(0, dot);
} else {
actual = this->_value;