aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-23 17:53:53 +0800
committerGitHub <noreply@github.com>2025-02-23 17:53:53 +0800
commitf932c7852e014bf608abdb617fb10dfc464ca9bc (patch)
tree1e5f3880cca4f9663c5f36f0ea21ba3738621089 /src/nvim/fileio.c
parent16e6f6e5841dd582620307e110b3da851e0e0a95 (diff)
parent365b865d6b92f3035e95ddbc1a7d111413cbe141 (diff)
downloadrneovim-f932c7852e014bf608abdb617fb10dfc464ca9bc.tar.gz
rneovim-f932c7852e014bf608abdb617fb10dfc464ca9bc.tar.bz2
rneovim-f932c7852e014bf608abdb617fb10dfc464ca9bc.zip
Merge pull request #32593 from zeertzjq/vim-9.1.1139
vim-patch:9.1.{1139,1141}
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 61b252f823..b79ecf22d7 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -353,10 +353,9 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
}
}
- if (!read_buffer && !read_stdin && !read_fifo) {
+ if (!read_stdin && fname != NULL) {
perm = os_getperm(fname);
- // On Unix it is possible to read a directory, so we have to
- // check for it before os_open().
+ }
#ifdef OPEN_CHR_FILES
# define IS_CHR_DEV(perm, fname) S_ISCHR(perm) && is_dev_fd_file(fname)
@@ -364,12 +363,15 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
# define IS_CHR_DEV(perm, fname) false
#endif
+ if (!read_stdin && !read_buffer && !read_fifo) {
if (perm >= 0 && !S_ISREG(perm) // not a regular file ...
&& !S_ISFIFO(perm) // ... or fifo
&& !S_ISSOCK(perm) // ... or socket
&& !(IS_CHR_DEV(perm, fname))
// ... or a character special file named /dev/fd/<n>
) {
+ // On Unix it is possible to read a directory, so we have to
+ // check for it before os_open().
if (S_ISDIR(perm)) {
if (!silent) {
filemess(curbuf, fname, _(msg_is_a_directory));