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/network.cc | |
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/network.cc')
-rw-r--r-- | hscript/network.cc | 12 |
1 files changed, 9 insertions, 3 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; |