aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/stdpaths.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os/stdpaths.c')
-rw-r--r--src/nvim/os/stdpaths.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c
index 31d85ac2eb..6b07b6ef70 100644
--- a/src/nvim/os/stdpaths.c
+++ b/src/nvim/os/stdpaths.c
@@ -2,6 +2,7 @@
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <stdbool.h>
+#include <string.h>
#include "nvim/ascii.h"
#include "nvim/fileio.h"
@@ -87,6 +88,9 @@ char *stdpaths_get_xdg_var(const XDGVarType idx)
} else if (idx == kXDGRuntimeDir) {
// Special-case: stdpath('run') is defined at startup.
ret = vim_gettempdir();
+ if (ret == NULL) {
+ ret = "/tmp/";
+ }
size_t len = strlen(ret);
ret = xstrndup(ret, len >= 2 ? len - 1 : 0); // Trim trailing slash.
}
@@ -117,7 +121,7 @@ char *get_xdg_home(const XDGVarType idx)
#endif
#ifdef BACKSLASH_IN_FILENAME
- slash_adjust((char_u *)dir);
+ slash_adjust(dir);
#endif
}
return dir;