summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2018-11-04 19:44:44 +0100
committerPřemysl Janouch <p@janouch.name>2018-11-04 19:46:06 +0100
commitfad0d264a502fdf6f8b1d4a06b02f04f5c902351 (patch)
treefef94b3431b94a10cd7d7942dda92bd4a961451b
parent473aa8788c5e663a25b38b7389e762052180bafe (diff)
downloadsdn-fad0d264a502fdf6f8b1d4a06b02f04f5c902351.tar.gz
sdn-fad0d264a502fdf6f8b1d4a06b02f04f5c902351.tar.xz
sdn-fad0d264a502fdf6f8b1d4a06b02f04f5c902351.zip
Support old libstdc++ 4.9
Now sdn can be built under Debian jessie with clang++ and libstdc++.
-rw-r--r--sdn.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/sdn.cpp b/sdn.cpp
index 6837f8c..044cfd6 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -246,8 +246,10 @@ fun xdg_config_find (const string &suffix) -> unique_ptr<ifstream> {
for (const auto &dir : dirs) {
if (dir[0] != '/')
continue;
- if (ifstream ifs {dir + "/" PROJECT_NAME "/" + suffix})
- return make_unique<ifstream> (move (ifs));
+ auto ifs = make_unique<ifstream>
+ (dir + "/" PROJECT_NAME "/" + suffix);
+ if (*ifs)
+ return ifs;
}
return nullptr;
}
@@ -259,8 +261,10 @@ fun xdg_config_write (const string &suffix) -> unique_ptr<fstream> {
if (!fork ())
_exit (-execlp ("mkdir", "mkdir", "-p",
dirname (strdup (path.c_str ())), NULL));
- if (fstream fs {path, fstream::in | fstream::out | fstream::trunc})
- return make_unique<fstream> (move (fs));
+ auto fs = make_unique<fstream>
+ (path, fstream::in | fstream::out | fstream::trunc);
+ if (*fs)
+ return fs;
}
return nullptr;
}