summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/session.cc b/src/session.cc
index aa09abe..0ae87df 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -19,8 +19,6 @@
using namespace Binc;
using std::string;
-extern char **environ;
-
Session::Session()
{
readbytes = 0;
@@ -192,17 +190,15 @@ int Session::timeout() const
bool Session::hasEnv(const string &key) const
{
- return getenv(key.c_str()) != nullptr;
+ return Tools::getenv(key).has_value();
}
string Session::getEnv(const string &key)
{
- char *c = getenv(key.c_str());
- return c ? c : "";
+ return Tools::getenv(key).value_or(string{});
}
void Session::setEnv(const string &key, const string &value)
{
- string env = key + "=" + value;
- putenv(strdup(env.c_str()));
+ Tools::setenv(key, value);
}