From 4becb7d7aa5ac1a0f7118f378f5f1e1ab1398c70 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 5 Jul 2022 01:24:31 -0500 Subject: 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! --- hscript/script_e.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hscript') 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; } -- cgit v1.2.3-70-g09d2