summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/remote.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/remote.cc b/src/remote.cc
index 138f56c6..c4d0cec0 100644
--- a/src/remote.cc
+++ b/src/remote.cc
@@ -480,10 +480,12 @@ void RemoteUI::set_ui_options(const Options& options)
m_socket_watcher.events() |= FdEvents::Write;
}
-static const char* tmpdir()
+static StringView tmpdir()
{
- if (const char* tmpdir = getenv("TMPDIR"))
- return tmpdir;
+ StringView tmpdir = getenv("TMPDIR");
+ if (not tmpdir.empty())
+ return tmpdir.back() == '/' ? tmpdir.substr(0_byte, tmpdir.length()-1)
+ : tmpdir;
return "/tmp";
}