summaryrefslogtreecommitdiff
path: root/hscript
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2022-07-05 01:24:31 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2022-07-05 01:24:31 -0500
commit4becb7d7aa5ac1a0f7118f378f5f1e1ab1398c70 (patch)
tree1ea323d2e07955a0fa0c1b302f98840d4352599d /hscript
parent61adaae76be7be859491c14f2f82570c11b762a4 (diff)
downloadhorizon-4becb7d7aa5ac1a0f7118f378f5f1e1ab1398c70.tar.gz
horizon-4becb7d7aa5ac1a0f7118f378f5f1e1ab1398c70.tar.bz2
horizon-4becb7d7aa5ac1a0f7118f378f5f1e1ab1398c70.tar.xz
horizon-4becb7d7aa5ac1a0f7118f378f5f1e1ab1398c70.zip
hscript: Better, more portable net conf reading
Checking in_avail doesn't work correctly on Darwin due to the way file caches work there. This method is not only more portable, but also more performant. A win-win!
Diffstat (limited to 'hscript')
-rw-r--r--hscript/script_e.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/hscript/script_e.cc b/hscript/script_e.cc
index 2ad1a98..3cdc78f 100644
--- a/hscript/script_e.cc
+++ b/hscript/script_e.cc
@@ -347,14 +347,14 @@ bool Script::execute() const {
case NetConfigType::Netifrc: {
const std::string variable(varfile.path().filename().string());
conf << variable << "=\"";
- if(contents.rdbuf()->in_avail()) conf << contents.rdbuf();
+ contents >> conf.rdbuf();
conf << "\"" << std::endl;
break;
}
case NetConfigType::ENI: {
const std::string iface(varfile.path().filename().string());
conf << "auto " << iface << std::endl;
- if(contents.rdbuf()->in_avail()) conf << contents.rdbuf();
+ contents >> conf.rdbuf();
conf << std::endl;
break;
}