Merge pull request #20983 from neovim/backport-20952-to-release-0.8

[Backport release-0.8] fix(stdpath): default to /tmp if stdpath('run') cannot be created
This commit is contained in:
zeertzjq
2022-11-07 09:19:42 +08:00
committed by GitHub

View File

@@ -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.
}