aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-07 09:08:25 +0800
committerGitHub <noreply@github.com>2022-11-06 17:08:25 -0800
commit8045296e8b6d10611a5fce2db0b9b90a1989100c (patch)
tree35c6790f2121988668692c9539b4ea7a01382331 /src
parentd6497c33b7039d143cfdb61cea5c71fa3d49aa32 (diff)
downloadrneovim-8045296e8b6d10611a5fce2db0b9b90a1989100c.tar.gz
rneovim-8045296e8b6d10611a5fce2db0b9b90a1989100c.tar.bz2
rneovim-8045296e8b6d10611a5fce2db0b9b90a1989100c.zip
fix(stdpath): default to /tmp if stdpath('run') cannot be created #20952
Fix #20949
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/stdpaths.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c
index 31d85ac2eb..2aaf776fc6 100644
--- a/src/nvim/os/stdpaths.c
+++ b/src/nvim/os/stdpaths.c
@@ -87,6 +87,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.
}