summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvimboss <devnull@localhost>2007-07-10 15:10:54 +0000
committervimboss <devnull@localhost>2007-07-10 15:10:54 +0000
commitce02ba7d6b709841ca37f7e4952f14d421fa11c1 (patch)
tree252e10283a3b75154d1780da2e1e3dddc81dbfea
parent02537de852d3c4a59c25e97a59721ca7b190e353 (diff)
downloadvim-ce02ba7d6b709841ca37f7e4952f14d421fa11c1.tar.gz
updated for version 7.1-027v7.1.027v7-1-027
-rw-r--r--src/fileio.c34
-rw-r--r--src/os_unix.h3
-rw-r--r--src/version.c2
3 files changed, 39 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 6fd2799c..3f094d4e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -44,6 +44,10 @@
/* Is there any system that doesn't have access()? */
#define USE_MCH_ACCESS
+#if defined(sun) && 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 __ARGS((char_u **pp));
# ifdef FEAT_EVAL
@@ -406,6 +410,10 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
# ifdef S_ISSOCK
&& !S_ISSOCK(perm) /* ... or socket */
# endif
+# ifdef OPEN_CHR_FILES
+ && !(S_ISCHR(perm) && is_dev_fd_file(fname))
+ /* ... or a character special file named /dev/fd/<n> */
+# endif
)
{
if (S_ISDIR(perm))
@@ -2265,6 +2273,13 @@ failed:
}
# endif
# endif
+# ifdef OPEN_CHR_FILES
+ if (S_ISCHR(perm)) /* or character special */
+ {
+ STRCAT(IObuff, _("[character special]"));
+ c = TRUE;
+ }
+# endif
#endif
if (curbuf->b_p_ro)
{
@@ -2464,6 +2479,25 @@ failed:
return OK;
}
+#ifdef OPEN_CHR_FILES
+/*
+ * 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
+is_dev_fd_file(fname)
+ char_u *fname;
+{
+ return (STRNCMP(fname, "/dev/fd/", 8) == 0
+ && VIM_ISDIGIT(fname[8])
+ && *skipdigits(fname + 9) == NUL
+ && (fname[9] != NUL
+ || (fname[8] != '0' && fname[8] != '1' && fname[8] != '2')));
+}
+#endif
+
#ifdef FEAT_MBYTE
/*
diff --git a/src/os_unix.h b/src/os_unix.h
index d99d1c8d..be6048fa 100644
--- a/src/os_unix.h
+++ b/src/os_unix.h
@@ -508,6 +508,9 @@ int mch_rename __ARGS((const char *src, const char *dest));
#if !defined(S_ISFIFO) && defined(S_IFIFO)
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif
+#if !defined(S_ISCHR) && defined(S_IFCHR)
+# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#endif
/* Note: Some systems need both string.h and strings.h (Savage). However,
* some systems can't handle both, only use string.h in that case. */
diff --git a/src/version.c b/src/version.c
index 6d915729..38095cba 100644
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 27,
+/**/
26,
/**/
25,