Support old libstdc++ 4.9

Now sdn can be built under Debian jessie with clang++ and libstdc++.
This commit is contained in:
Přemysl Eric Janouch 2018-11-04 19:44:44 +01:00
parent 473aa8788c
commit fad0d264a5
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 8 additions and 4 deletions

12
sdn.cpp
View File

@ -246,8 +246,10 @@ fun xdg_config_find (const string &suffix) -> unique_ptr<ifstream> {
for (const auto &dir : dirs) { for (const auto &dir : dirs) {
if (dir[0] != '/') if (dir[0] != '/')
continue; continue;
if (ifstream ifs {dir + "/" PROJECT_NAME "/" + suffix}) auto ifs = make_unique<ifstream>
return make_unique<ifstream> (move (ifs)); (dir + "/" PROJECT_NAME "/" + suffix);
if (*ifs)
return ifs;
} }
return nullptr; return nullptr;
} }
@ -259,8 +261,10 @@ fun xdg_config_write (const string &suffix) -> unique_ptr<fstream> {
if (!fork ()) if (!fork ())
_exit (-execlp ("mkdir", "mkdir", "-p", _exit (-execlp ("mkdir", "mkdir", "-p",
dirname (strdup (path.c_str ())), NULL)); dirname (strdup (path.c_str ())), NULL));
if (fstream fs {path, fstream::in | fstream::out | fstream::trunc}) auto fs = make_unique<fstream>
return make_unique<fstream> (move (fs)); (path, fstream::in | fstream::out | fstream::trunc);
if (*fs)
return fs;
} }
return nullptr; return nullptr;
} }