summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-20 15:05:39 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-20 15:05:39 +0200
commitf04507d132fbcb63999167ec006fc6e700b5af4f (patch)
treefdbe08b22d341af7c2178126f8b32bcae5d16c5c /src
parent9e4d8215d386100ab660d7d11e6620fd148b605e (diff)
downloadvim-f04507d132fbcb63999167ec006fc6e700b5af4f.zip
patch 7.4.2229
Problem: Startup test fails on Solaris. Solution: Recognize a character device. (Danek Duvall)
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c3
-rw-r--r--src/fileio.c8
-rw-r--r--src/proto/fileio.pro1
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h4
5 files changed, 12 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 4f6888255..184f09f35 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -220,6 +220,9 @@ open_buffer(
# ifdef S_ISSOCK
|| S_ISSOCK(perm)
# endif
+# ifdef OPEN_CHR_FILES
+ || (S_ISCHR(perm) && is_dev_fd_file(curbuf->b_ffname))
+# endif
))
read_fifo = TRUE;
if (read_fifo)
diff --git a/src/fileio.c b/src/fileio.c
index 3c3d54835..5e53feef4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -27,10 +27,6 @@
/* Is there any system that doesn't have access()? */
#define USE_MCH_ACCESS
-#if (defined(sun) || defined(__FreeBSD__)) && defined(S_ISCHR)
-# define OPEN_CHR_FILES
-static int is_dev_fd_file(char_u *fname);
-#endif
#ifdef FEAT_MBYTE
static char_u *next_fenc(char_u **pp);
# ifdef FEAT_EVAL
@@ -2718,14 +2714,14 @@ failed:
return OK;
}
-#ifdef OPEN_CHR_FILES
+#if defined(OPEN_CHR_FILES) || defined(PROTO)
/*
* Returns TRUE if the file name argument is of the form "/dev/fd/\d\+",
* which is the name of files used for process substitution output by
* some shells on some operating systems, e.g., bash on SunOS.
* Do not accept "/dev/fd/[012]", opening these may hang Vim.
*/
- static int
+ int
is_dev_fd_file(char_u *fname)
{
return (STRNCMP(fname, "/dev/fd/", 8) == 0
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
index 748bf4c9b..30582d4e1 100644
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -1,6 +1,7 @@
/* fileio.c */
void filemess(buf_T *buf, char_u *name, char_u *s, int attr);
int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip, linenr_T lines_to_read, exarg_T *eap, int flags);
+int is_dev_fd_file(char_u *fname);
int prep_exarg(exarg_T *eap, buf_T *buf);
void set_file_options(int set_options, exarg_T *eap);
void set_forced_fenc(exarg_T *eap);
diff --git a/src/version.c b/src/version.c
index 6486e6a67..2f832706e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2229,
+/**/
2228,
/**/
2227,
diff --git a/src/vim.h b/src/vim.h
index 88d4850ef..898ebb60b 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2485,4 +2485,8 @@ typedef enum
#define FNE_INCL_BR 1 /* include [] in name */
#define FNE_CHECK_START 2 /* check name starts with valid character */
+#if (defined(sun) || defined(__FreeBSD__)) && defined(S_ISCHR)
+# define OPEN_CHR_FILES
+#endif
+
#endif /* VIM__H */