diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2022-06-30 13:16:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-30 04:16:46 -0700 |
commit | f50135a32e11c535e1dc3a8e9460c5b4e640ee86 (patch) | |
tree | 4531a75f5f099877cb8d672743abf03004171f4f /src/nvim/main.c | |
parent | 514e76e4b2903530922529c60bfbf32cadd257a3 (diff) | |
download | rneovim-f50135a32e11c535e1dc3a8e9460c5b4e640ee86.tar.gz rneovim-f50135a32e11c535e1dc3a8e9460c5b4e640ee86.tar.bz2 rneovim-f50135a32e11c535e1dc3a8e9460c5b4e640ee86.zip |
feat: stdpath('run'), /tmp/nvim.user/ #18993
Problem:
- Since c57f6b28d71d #8519, sockets are created in ~/.local/… but XDG
spec says: "XDG_RUNTIME_DIR: Must be on the local filesystem", which
implies that XDG_STATE_DIR is potentially non-local.
- Not easy to inspect Nvim-created temp files (for debugging etc).
Solution:
- Store sockets in stdpath('run') ($XDG_RUNTIME_DIR).
- Establish "/tmp/nvim.user/" as the tempdir root shared by all Nvims.
- Make ok() actually useful.
- Introduce assert_nolog().
closes #3517
closes #17093
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r-- | src/nvim/main.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 2b5a5a9033..a7e39b7655 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -2016,14 +2016,14 @@ static void source_startup_scripts(const mparm_T *const parmp) // do_user_initialization. #if defined(UNIX) // If vimrc file is not owned by user, set 'secure' mode. - if (!file_owned(VIMRC_FILE)) + if (!os_file_owned(VIMRC_FILE)) // NOLINT(readability/braces) #endif secure = p_secure; if (do_source(VIMRC_FILE, true, DOSO_VIMRC) == FAIL) { #if defined(UNIX) // if ".exrc" is not owned by user set 'secure' mode - if (!file_owned(EXRC_FILE)) { + if (!os_file_owned(EXRC_FILE)) { secure = p_secure; } else { secure = 0; @@ -2068,23 +2068,6 @@ static int execute_env(char *env) return FAIL; } -#ifdef UNIX -/// Checks if user owns file. -/// Use both uv_fs_stat() and uv_fs_lstat() through os_fileinfo() and -/// os_fileinfo_link() respectively for extra security. -static bool file_owned(const char *fname) -{ - assert(fname != NULL); - uid_t uid = getuid(); - FileInfo file_info; - bool file_owned = os_fileinfo(fname, &file_info) - && file_info.stat.st_uid == uid; - bool link_owned = os_fileinfo_link(fname, &file_info) - && file_info.stat.st_uid == uid; - return file_owned && link_owned; -} -#endif - /// Prints the following then exits: /// - An error message `errstr` /// - A string `str` if not null |