patch 9.1.1514: Coverity complains about the use of tmpfile() Commit: https://github.com/vim/vim/commit/b7b4bb36aa8f7571b8798421276987dc4d63de0b Author: Christian Brabandt <c...@256bit.org> Date: Sun Jul 6 10:39:59 2025 +0200
patch 9.1.1514: Coverity complains about the use of tmpfile() Problem: coverity complains about the use of tmpfile() Solution: use vim_tempname() instead to create anonym file related: #17097 closes: #17674 Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/os_unix.c b/src/os_unix.c index 9fd6436e6..c27755f95 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -8940,13 +8940,24 @@ mch_create_anon_file(void) fd = shm_open(template, O_CREAT | O_RDWR | O_EXCL, 0600); if (fd >= 0 || errno != EEXIST) - break; } + break; + } // Remove object name from namespace shm_unlink(template); #endif + // Last resort if (fd == -1) - // Last resort - fd = fileno(tmpfile()); - + { + char_u *tempname; + // get a name for the temp file + if ((tempname = vim_tempname('w', FALSE)) == NULL) + { + emsg(_(e_cant_get_temp_file_name)); + return -1; + } + fd = mch_open((char *)tempname, O_CREAT | O_RDWR | O_EXCL, 0600); + mch_remove(tempname); + vim_free(tempname); + } return fd; } diff --git a/src/version.c b/src/version.c index fdf1eb300..1cf223d18 100644 --- a/src/version.c +++ b/src/version.c @@ -719,6 +719,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1514, /**/ 1513, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uYKzj-006N5E-Hm%40256bit.org.