diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-14 09:21:22 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-14 09:21:22 -0500 |
commit | aec0842632ea32fec9939c221fb5554d1900a3a5 (patch) | |
tree | 440e3e59d392e684397f14d1f9bc6ca47d159df9 /hscript | |
parent | e23831df4386ebccd89e768f543533e3364b5333 (diff) | |
download | horizon-aec0842632ea32fec9939c221fb5554d1900a3a5.tar.gz horizon-aec0842632ea32fec9939c221fb5554d1900a3a5.tar.bz2 horizon-aec0842632ea32fec9939c221fb5554d1900a3a5.tar.xz horizon-aec0842632ea32fec9939c221fb5554d1900a3a5.zip |
hscript: A few changes [read full message]
* Handle ENODEV as well as EOPNOTSUPP in NetSSID::validate.
Whether iface is not wifi or doesn't exist, same result per spec.
* *Failures* are fatal, but *ENODEV/EOPNOTSUPP* is not a failure.
So, repair logic in Script::validate and return proper value.
Diffstat (limited to 'hscript')
-rw-r--r-- | hscript/network.cc | 12 | ||||
-rw-r--r-- | hscript/script.cc | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/hscript/network.cc b/hscript/network.cc index e02e5df..c8f42de 100644 --- a/hscript/network.cc +++ b/hscript/network.cc @@ -324,11 +324,17 @@ bool NetSSID::validate(ScriptOptions options) const { this->_iface.size()); errno = 0; if(ioctl(my_sock, SIOCGIWNAME, &request) == -1) { - if(errno == EOPNOTSUPP) { + switch(errno) + { + case EOPNOTSUPP: output_warning("installfile:" + std::to_string(this->lineno()), "netssid: interface specified is not wireless"); - return false; - } else { + return true; + case ENODEV: + output_warning("installfile:" + std::to_string(this->lineno()), + "netssid: specified interface does not exist"); + return true; + default: output_error("installfile:" + std::to_string(this->lineno()), "netssid: error communicating with wireless device"); return false; diff --git a/hscript/script.cc b/hscript/script.cc index 29e0118..444b6c0 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -392,8 +392,9 @@ bool Script::validate() const { /* Runner.Validate.network.netssid */ for(auto &ssid : this->internal->ssids) { - ssid->validate(this->opts); - /* Failure is not fatal per spec. */ + if(!ssid->validate(this->opts)) { + failures++; + } } if(this->internal->repos.size() == 0) { |