Skip to content

Commit f04507d

Browse files
committed
patch 7.4.2229
Problem: Startup test fails on Solaris. Solution: Recognize a character device. (Danek Duvall)
1 parent 9e4d821 commit f04507d

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/buffer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ open_buffer(
219219
# endif
220220
# ifdef S_ISSOCK
221221
|| S_ISSOCK(perm)
222+
# endif
223+
# ifdef OPEN_CHR_FILES
224+
|| (S_ISCHR(perm) && is_dev_fd_file(curbuf->b_ffname))
222225
# endif
223226
))
224227
read_fifo = TRUE;

src/fileio.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727
/* Is there any system that doesn't have access()? */
2828
#define USE_MCH_ACCESS
2929

30-
#if (defined(sun) || defined(__FreeBSD__)) && defined(S_ISCHR)
31-
# define OPEN_CHR_FILES
32-
static int is_dev_fd_file(char_u *fname);
33-
#endif
3430
#ifdef FEAT_MBYTE
3531
static char_u *next_fenc(char_u **pp);
3632
# ifdef FEAT_EVAL
@@ -2718,14 +2714,14 @@ readfile(
27182714
return OK;
27192715
}
27202716

2721-
#ifdef OPEN_CHR_FILES
2717+
#if defined(OPEN_CHR_FILES) || defined(PROTO)
27222718
/*
27232719
* Returns TRUE if the file name argument is of the form "/dev/fd/\d\+",
27242720
* which is the name of files used for process substitution output by
27252721
* some shells on some operating systems, e.g., bash on SunOS.
27262722
* Do not accept "/dev/fd/[012]", opening these may hang Vim.
27272723
*/
2728-
static int
2724+
int
27292725
is_dev_fd_file(char_u *fname)
27302726
{
27312727
return (STRNCMP(fname, "/dev/fd/", 8) == 0

src/proto/fileio.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* fileio.c */
22
void filemess(buf_T *buf, char_u *name, char_u *s, int attr);
33
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);
4+
int is_dev_fd_file(char_u *fname);
45
int prep_exarg(exarg_T *eap, buf_T *buf);
56
void set_file_options(int set_options, exarg_T *eap);
67
void set_forced_fenc(exarg_T *eap);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2229,
766768
/**/
767769
2228,
768770
/**/

src/vim.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,4 +2485,8 @@ typedef enum
24852485
#define FNE_INCL_BR 1 /* include [] in name */
24862486
#define FNE_CHECK_START 2 /* check name starts with valid character */
24872487

2488+
#if (defined(sun) || defined(__FreeBSD__)) && defined(S_ISCHR)
2489+
# define OPEN_CHR_FILES
2490+
#endif
2491+
24882492
#endif /* VIM__H */

0 commit comments

Comments
 (0)