]>
Commit | Line | Data |
---|---|---|
ad28a8ff AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.027 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.027 | |
11 | Problem: On Sun systems opening /dev/fd/N doesn't work, and they are used | |
12 | by process substitutions. | |
13 | Solution: Allow opening specific character special files for Sun systems. | |
14 | (Gary Johnson) | |
15 | Files: src/fileio.c, src/os_unix.h | |
16 | ||
17 | ||
18 | *** ../vim-7.1.026/src/fileio.c Thu Jun 28 21:57:08 2007 | |
19 | --- src/fileio.c Mon Jul 9 11:19:50 2007 | |
20 | *************** | |
21 | *** 44,49 **** | |
22 | --- 44,53 ---- | |
23 | /* Is there any system that doesn't have access()? */ | |
24 | #define USE_MCH_ACCESS | |
25 | ||
26 | + #if defined(sun) && defined(S_ISCHR) | |
27 | + # define OPEN_CHR_FILES | |
28 | + static int is_dev_fd_file(char_u *fname); | |
29 | + #endif | |
30 | #ifdef FEAT_MBYTE | |
31 | static char_u *next_fenc __ARGS((char_u **pp)); | |
32 | # ifdef FEAT_EVAL | |
33 | *************** | |
34 | *** 406,411 **** | |
35 | --- 410,419 ---- | |
36 | # ifdef S_ISSOCK | |
37 | && !S_ISSOCK(perm) /* ... or socket */ | |
38 | # endif | |
39 | + # ifdef OPEN_CHR_FILES | |
40 | + && !(S_ISCHR(perm) && is_dev_fd_file(fname)) | |
41 | + /* ... or a character special file named /dev/fd/<n> */ | |
42 | + # endif | |
43 | ) | |
44 | { | |
45 | if (S_ISDIR(perm)) | |
46 | *************** | |
47 | *** 2265,2270 **** | |
48 | --- 2273,2285 ---- | |
49 | } | |
50 | # endif | |
51 | # endif | |
52 | + # ifdef OPEN_CHR_FILES | |
53 | + if (S_ISCHR(perm)) /* or character special */ | |
54 | + { | |
55 | + STRCAT(IObuff, _("[character special]")); | |
56 | + c = TRUE; | |
57 | + } | |
58 | + # endif | |
59 | #endif | |
60 | if (curbuf->b_p_ro) | |
61 | { | |
62 | *************** | |
63 | *** 2463,2468 **** | |
64 | --- 2478,2502 ---- | |
65 | return FAIL; | |
66 | return OK; | |
67 | } | |
68 | + | |
69 | + #ifdef OPEN_CHR_FILES | |
70 | + /* | |
71 | + * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+", | |
72 | + * which is the name of files used for process substitution output by | |
73 | + * some shells on some operating systems, e.g., bash on SunOS. | |
74 | + * Do not accept "/dev/fd/[012]", opening these may hang Vim. | |
75 | + */ | |
76 | + static int | |
77 | + is_dev_fd_file(fname) | |
78 | + char_u *fname; | |
79 | + { | |
80 | + return (STRNCMP(fname, "/dev/fd/", 8) == 0 | |
81 | + && VIM_ISDIGIT(fname[8]) | |
82 | + && *skipdigits(fname + 9) == NUL | |
83 | + && (fname[9] != NUL | |
84 | + || (fname[8] != '0' && fname[8] != '1' && fname[8] != '2'))); | |
85 | + } | |
86 | + #endif | |
87 | ||
88 | #ifdef FEAT_MBYTE | |
89 | ||
90 | *** ../vim-7.1.026/src/os_unix.h Thu May 10 19:43:10 2007 | |
91 | --- src/os_unix.h Sat Jul 7 13:08:56 2007 | |
92 | *************** | |
93 | *** 508,513 **** | |
94 | --- 508,516 ---- | |
95 | #if !defined(S_ISFIFO) && defined(S_IFIFO) | |
96 | # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | |
97 | #endif | |
98 | + #if !defined(S_ISCHR) && defined(S_IFCHR) | |
99 | + # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | |
100 | + #endif | |
101 | ||
102 | /* Note: Some systems need both string.h and strings.h (Savage). However, | |
103 | * some systems can't handle both, only use string.h in that case. */ | |
104 | *** ../vim-7.1.026/src/version.c Tue Jul 10 14:02:51 2007 | |
105 | --- src/version.c Tue Jul 10 17:00:43 2007 | |
106 | *************** | |
107 | *** 668,669 **** | |
108 | --- 668,671 ---- | |
109 | { /* Add new patch number below this line */ | |
110 | + /**/ | |
111 | + 27, | |
112 | /**/ | |
113 | ||
114 | -- | |
115 | Every exit is an entrance into something else. | |
116 | ||
117 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
118 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
119 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
120 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |