Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/redir.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
19 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
20 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
21 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
24 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
26 | int expanding_redir; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
28 | extern REDIRECT *redirection_undo_list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
29 | extern REDIRECT *exec_redirection_undo_list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
32 | static void add_exec_redirect (REDIRECT *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
33 | static int add_undo_redirect (int, enum r_instruction, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
34 | static int add_undo_close_redirect (int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
35 | static int expandable_redirection_filename (REDIRECT *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
36 | static int stdin_redirection (enum r_instruction, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
37 | static int undoablefd (int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
38 | static int do_redirection_internal (REDIRECT *, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
39 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
40 | static int write_here_document (int, WORD_DESC *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
41 | static int write_here_string (int, WORD_DESC *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
42 | static int here_document_to_fd (WORD_DESC *, enum r_instruction); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
44 | static int redir_special_open (int, char *, int, int, enum r_instruction); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
45 | static int noclobber_open (char *, int, int, enum r_instruction); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
46 | static int redir_open (char *, int, int, enum r_instruction); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
48 | static int redir_varassign (REDIRECT *, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
49 | static int redir_varvalue (REDIRECT *); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
52 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
53 | static REDIRECTEE rd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
57 | static int heredoc_errno; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
58 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
59 | redirection_error (temp, error) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
60 | REDIRECT *temp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
61 | int error; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
62 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
63 | char *filename, *allocname; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
64 | int oflags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
66 | allocname = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
67 | if ((
| 1-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
68 | filename = allocname = (char *)strcpy (sh_xmalloc((1 + strlen (temp->redirector.filename->word)), "redir.c", 117), (temp->redirector.filename->word)); executed 8 times by 1 test: filename = allocname = (char *)strcpy (sh_xmalloc((1 + strlen (temp->redirector.filename->word)), "redir.c", 117), (temp->redirector.filename->word)); Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
69 | else if ((
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
70 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
72 | filename = never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
73 | dcgettext (((void *)0), never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
74 | "file descriptor out of range" never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
75 | , 5) never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
76 | ; never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
79 | else if (error != -2
| 0-86 | ||||||||||||||||||||||||||||||||||||||||||||||||
80 | 9
| 31-55 | ||||||||||||||||||||||||||||||||||||||||||||||||
81 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
82 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
86 | switch (temp->instruction) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
87 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
88 | case never executed: r_duplicating_input:case r_duplicating_input: never executed: case r_duplicating_input: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
89 | case never executed: r_duplicating_output:case r_duplicating_output: never executed: case r_duplicating_output: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
90 | case never executed: r_move_input:case r_move_input: never executed: case r_move_input: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
91 | case never executed: r_move_output:case r_move_output: never executed: case r_move_output: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
92 | filename = allocname = itos (temp->redirectee.dest); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
93 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
94 | case never executed: r_duplicating_input_word:case r_duplicating_input_word: never executed: case r_duplicating_input_word: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
95 | if (temp->redirector.dest == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
96 | filename = temp->redirectee.filename->word; never executed: filename = temp->redirectee.filename->word; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
97 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
98 | filename = allocname = itos (temp->redirector.dest); never executed: filename = allocname = itos (temp->redirector.dest); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
99 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
100 | case executed 55 times by 1 test: r_duplicating_output_word:case r_duplicating_output_word: Executed by:
executed 55 times by 1 test: case r_duplicating_output_word: Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||
101 | if (temp->redirector.dest == 1
| 0-55 | ||||||||||||||||||||||||||||||||||||||||||||||||
102 | filename = temp->redirectee.filename->word; executed 55 times by 1 test: filename = temp->redirectee.filename->word; Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||
103 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
104 | filename = allocname = itos (temp->redirector.dest); never executed: filename = allocname = itos (temp->redirector.dest); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
105 | break; executed 55 times by 1 test: break; Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||
106 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
107 | filename = allocname = itos (temp->redirector.dest); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
108 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
109 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
110 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
112 | else if (expandable_redirection_filename (temp)
| 0-50 | ||||||||||||||||||||||||||||||||||||||||||||||||
113 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
114 | oflags = temp->redirectee.filename->flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
115 | if (posixly_correct
| 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||
116 | temp->redirectee.filename->flags |= 0x000020; executed 2 times by 1 test: temp->redirectee.filename->flags |= 0x000020; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
117 | temp->redirectee.filename->flags |= 0x000400; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
118 | filename = allocname = redirection_expand (temp->redirectee.filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
119 | temp->redirectee.filename->flags = oflags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
120 | if (filename == 0
| 8-42 | ||||||||||||||||||||||||||||||||||||||||||||||||
121 | filename = temp->redirectee.filename->word; executed 8 times by 1 test: filename = temp->redirectee.filename->word; Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
122 | } executed 50 times by 1 test: end of block Executed by:
| 50 | ||||||||||||||||||||||||||||||||||||||||||||||||
123 | else if (temp->redirectee.dest < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
124 | filename = never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
125 | dcgettext (((void *)0), never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
126 | "file descriptor out of range" never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
127 | , 5) never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
128 | ; never executed: filename = dcgettext (((void *)0), "file descriptor out of range" , 5) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
129 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
130 | filename = allocname = itos (temp->redirectee.dest); never executed: filename = allocname = itos (temp->redirectee.dest); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
132 | switch (error) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
133 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
134 | case executed 9 times by 1 test: -1:case -1: Executed by:
executed 9 times by 1 test: case -1: Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||
135 | internal_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
136 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
137 | "%s: ambiguous redirect" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
138 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
139 | , filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
140 | break; executed 9 times by 1 test: break; Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
142 | case executed 19 times by 1 test: -2:case -2: Executed by:
executed 19 times by 1 test: case -2: Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
143 | internal_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
144 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
145 | "%s: cannot overwrite existing file" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
146 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
147 | , filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
148 | break; executed 19 times by 1 test: break; Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
149 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
150 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
151 | case executed 2 times by 1 test: -3:case -3: Executed by:
executed 2 times by 1 test: case -3: Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
152 | internal_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
153 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
154 | "%s: restricted: cannot redirect output" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
155 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
156 | , filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
157 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
160 | case never executed: -4:case -4: never executed: case -4: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
161 | internal_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
162 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
163 | "cannot create temp file for here-document: %s" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
164 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
165 | , strerror (heredoc_errno)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
166 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
168 | case executed 7 times by 1 test: -5:case -5: Executed by:
executed 7 times by 1 test: case -5: Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||
169 | internal_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
170 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
171 | "%s: cannot assign fd to variable" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
172 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
173 | , filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
174 | break; executed 7 times by 1 test: break; Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
176 | default executed 76 times by 1 test: :default: Executed by:
executed 76 times by 1 test: default: Executed by:
| 76 | ||||||||||||||||||||||||||||||||||||||||||||||||
177 | internal_error ("%s: %s", filename, strerror (error)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
178 | break; executed 76 times by 1 test: break; Executed by:
| 76 | ||||||||||||||||||||||||||||||||||||||||||||||||
179 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
180 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
181 | do { if (allocname
executed 50 times by 1 test: } while (0);sh_xfree((allocname), "redir.c", 200); Executed by:
| 50-63 | ||||||||||||||||||||||||||||||||||||||||||||||||
182 | } executed 113 times by 1 test: end of block Executed by:
| 113 | ||||||||||||||||||||||||||||||||||||||||||||||||
183 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
190 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
191 | do_redirections (list, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
192 | REDIRECT *list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
193 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
194 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
195 | int error; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
196 | REDIRECT *temp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
198 | if (flags & 0x02
| 30628501-242478214 | ||||||||||||||||||||||||||||||||||||||||||||||||
199 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
200 | if (redirection_undo_list
| 0-242478214 | ||||||||||||||||||||||||||||||||||||||||||||||||
201 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
202 | dispose_redirects (redirection_undo_list); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
203 | redirection_undo_list = (REDIRECT *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
204 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
205 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
206 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
207 | if (exec_redirection_undo_list
| 37-242478177 | ||||||||||||||||||||||||||||||||||||||||||||||||
208 | dispose_exec_redirects (); executed 37 times by 1 test: dispose_exec_redirects (); Executed by:
| 37 | ||||||||||||||||||||||||||||||||||||||||||||||||
209 | } executed 242478214 times by 1 test: end of block Executed by:
| 242478214 | ||||||||||||||||||||||||||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
211 | for (temp = list; temp
| 1366014-273105229 | ||||||||||||||||||||||||||||||||||||||||||||||||
212 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
213 | error = do_redirection_internal (temp, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
214 | if (error
| 113-1364528 | ||||||||||||||||||||||||||||||||||||||||||||||||
215 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
216 | redirection_error (temp, error); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
217 | return executed 113 times by 1 test: (error);return (error); Executed by:
executed 113 times by 1 test: return (error); Executed by:
| 113 | ||||||||||||||||||||||||||||||||||||||||||||||||
218 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
219 | } executed 1364528 times by 1 test: end of block Executed by:
| 1364528 | ||||||||||||||||||||||||||||||||||||||||||||||||
220 | return executed 273105229 times by 1 test: (0);return (0); Executed by:
executed 273105229 times by 1 test: return (0); Executed by:
| 273105229 | ||||||||||||||||||||||||||||||||||||||||||||||||
221 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
223 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
225 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
226 | expandable_redirection_filename (redirect) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
227 | REDIRECT *redirect; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
228 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
229 | switch (redirect->instruction) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
230 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
231 | case executed 26 times by 1 test: r_output_direction:case r_output_direction: Executed by:
executed 26 times by 1 test: case r_output_direction: Executed by:
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||
232 | case executed 1 time by 1 test: r_appending_to:case r_appending_to: Executed by:
executed 1 time by 1 test: case r_appending_to: Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
233 | case executed 16 times by 1 test: r_input_direction:case r_input_direction: Executed by:
executed 16 times by 1 test: case r_input_direction: Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
234 | case never executed: r_inputa_direction:case r_inputa_direction: never executed: case r_inputa_direction: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
235 | case never executed: r_err_and_out:case r_err_and_out: never executed: case r_err_and_out: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
236 | case never executed: r_append_err_and_out:case r_append_err_and_out: never executed: case r_append_err_and_out: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
237 | case never executed: r_input_output:case r_input_output: never executed: case r_input_output: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
238 | case never executed: r_output_force:case r_output_force: never executed: case r_output_force: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
239 | case executed 1 time by 1 test: r_duplicating_input_word:case r_duplicating_input_word: Executed by:
executed 1 time by 1 test: case r_duplicating_input_word: Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
240 | case executed 6 times by 1 test: r_duplicating_output_word:case r_duplicating_output_word: Executed by:
executed 6 times by 1 test: case r_duplicating_output_word: Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
241 | case never executed: r_move_input_word:case r_move_input_word: never executed: case r_move_input_word: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
242 | case never executed: r_move_output_word:case r_move_output_word: never executed: case r_move_output_word: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
243 | return executed 50 times by 1 test: 1;return 1; Executed by:
executed 50 times by 1 test: return 1; Executed by:
| 50 | ||||||||||||||||||||||||||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
245 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
246 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
247 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
248 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
252 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
253 | redirection_expand (word) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
254 | WORD_DESC *word; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
255 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
256 | char *result; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
257 | WORD_LIST *tlist1, *tlist2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
258 | WORD_DESC *w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
259 | int old; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
261 | w = copy_word (word); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
262 | if (posixly_correct
| 15-667558 | ||||||||||||||||||||||||||||||||||||||||||||||||
263 | w->flags |= 0x000010; executed 15 times by 1 test: w->flags |= 0x000010; Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
265 | tlist1 = make_word_list (w, (WORD_LIST *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
266 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
267 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
268 | expanding_redir = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
270 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
271 | sv_ifs ("IFS"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
272 | tlist2 = expand_words_no_vars (tlist1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
273 | expanding_redir = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
278 | old = executing_builtin; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
279 | executing_builtin = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
280 | sv_ifs ("IFS"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
281 | executing_builtin = old; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
282 | dispose_words (tlist1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
284 | if (tlist2 == 0
| 7-666192 | ||||||||||||||||||||||||||||||||||||||||||||||||
285 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
288 | if (tlist2
| 7-9 | ||||||||||||||||||||||||||||||||||||||||||||||||
289 | dispose_words (tlist2); executed 7 times by 1 test: dispose_words (tlist2); Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||
290 | return executed 16 times by 1 test: ((char *)return ((char *) ((void *)0) ); Executed by:
executed 16 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
291 | ((void *)0) executed 16 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
292 | ); executed 16 times by 1 test: return ((char *) ((void *)0) ); Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
293 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
294 | result = string_list (tlist2); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
295 | dispose_words (tlist2); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
296 | return executed 666185 times by 1 test: (result);return (result); Executed by:
executed 666185 times by 1 test: return (result); Executed by:
| 666185 | ||||||||||||||||||||||||||||||||||||||||||||||||
297 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
299 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
300 | write_here_string (fd, redirectee) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
301 | int fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
302 | WORD_DESC *redirectee; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
303 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
304 | char *herestr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
305 | int herelen, n, e, old; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
306 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
307 | expanding_redir = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
308 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
310 | sv_ifs ("IFS"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
311 | herestr = expand_string_unsplit_to_string (redirectee->word, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
312 | expanding_redir = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
314 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
315 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
317 | old = executing_builtin; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
318 | executing_builtin = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
319 | sv_ifs ("IFS"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
320 | executing_builtin = old; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
321 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
322 | herelen = (((
| 0-31 | ||||||||||||||||||||||||||||||||||||||||||||||||
323 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
324 | n = write (fd, herestr, herelen); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
325 | if (n == herelen
| 0-31 | ||||||||||||||||||||||||||||||||||||||||||||||||
326 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
327 | n = write (fd, "\n", 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
328 | herelen = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
329 | } executed 31 times by 1 test: end of block Executed by:
| 31 | ||||||||||||||||||||||||||||||||||||||||||||||||
330 | e = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
331 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
332 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
333 | do { if (herestr
executed 31 times by 1 test: } while (0);sh_xfree((herestr), "redir.c", 344); Executed by:
| 0-31 | ||||||||||||||||||||||||||||||||||||||||||||||||
334 | if (n != herelen
| 0-31 | ||||||||||||||||||||||||||||||||||||||||||||||||
335 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
336 | if (e == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
337 | e = never executed: e = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
338 | 28 never executed: e = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
339 | ; never executed: e = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
340 | return never executed: e;return e; never executed: return e; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
341 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
342 | return executed 31 times by 1 test: 0;return 0; Executed by:
executed 31 times by 1 test: return 0; Executed by:
| 31 | ||||||||||||||||||||||||||||||||||||||||||||||||
343 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
344 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
345 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
348 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
349 | write_here_document (fd, redirectee) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
350 | int fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
351 | WORD_DESC *redirectee; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
352 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
353 | char *document; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
354 | int document_len, fd2, old; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
355 | FILE *fp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
356 | register WORD_LIST *t, *tlist; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
358 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
360 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
361 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
362 | if (redirectee->flags & 0x000002
| 1-72 | ||||||||||||||||||||||||||||||||||||||||||||||||
363 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
364 | document = redirectee->word; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
365 | document_len = strlen (document); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
367 | if (write (fd, document, document_len) < document_len
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||
368 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
369 | if ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
370 | (*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
371 | == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
372 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
373 | (* never executed: __errno_location ()) (*__errno_location ()) = 28 ; never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
374 | = never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
375 | 28 never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
376 | ; never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
377 | return never executed: (return ( (*__errno_location ()) ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
378 | (*__errno_location ()) never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
379 | ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
380 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
381 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
382 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
383 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
384 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
385 | expanding_redir = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
387 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
388 | sv_ifs ("IFS"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
389 | tlist = expand_string (redirectee->word, 0x002); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
390 | expanding_redir = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
395 | old = executing_builtin; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
396 | executing_builtin = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
397 | sv_ifs ("IFS"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
398 | executing_builtin = old; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
399 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
400 | if (tlist
| 0-72 | ||||||||||||||||||||||||||||||||||||||||||||||||
401 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
407 | if ((
| 0-72 | ||||||||||||||||||||||||||||||||||||||||||||||||
408 | ((void *)0)
| 0-72 | ||||||||||||||||||||||||||||||||||||||||||||||||
409 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
410 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
411 | old = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
412 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
413 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
414 | if (fd2 >= 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
415 | close (fd2); never executed: close (fd2); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
416 | dispose_words (tlist); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
417 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
418 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
419 | = old; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
420 | return never executed: (return ( (*__errno_location ()) ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
421 | (*__errno_location ()) never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
422 | ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
423 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
424 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
425 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
426 | = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
427 | for (t = tlist; t
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||
428 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
429 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
431 | document = t->word->word; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
432 | document_len = strlen (document); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
433 | if (t != tlist
| 0-72 | ||||||||||||||||||||||||||||||||||||||||||||||||
434 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
435 | _IO_putc ( never executed: _IO_putc ( ' ' , fp ) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
436 | ' ' never executed: _IO_putc ( ' ' , fp ) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
437 | , never executed: _IO_putc ( ' ' , fp ) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
438 | fp never executed: _IO_putc ( ' ' , fp ) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
439 | ) never executed: _IO_putc ( ' ' , fp ) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
440 | ; never executed: _IO_putc ( ' ' , fp ) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
441 | fwrite (document, document_len, 1, fp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
442 | if (ferror (fp)
| 0-72 | ||||||||||||||||||||||||||||||||||||||||||||||||
443 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
444 | if ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
445 | (*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
446 | == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
447 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
448 | (* never executed: __errno_location ()) (*__errno_location ()) = 28 ; never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
449 | = never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
450 | 28 never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
451 | ; never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
452 | fd2 = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
453 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
454 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
455 | fclose(fp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
456 | dispose_words (tlist); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
457 | return never executed: (fd2);return (fd2); never executed: return (fd2); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
458 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
459 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||
460 | dispose_words (tlist); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
461 | if (fclose (fp) != 0
| 0-72 | ||||||||||||||||||||||||||||||||||||||||||||||||
462 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
463 | if ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
464 | (*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
465 | == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
467 | (* never executed: __errno_location ()) (*__errno_location ()) = 28 ; never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
468 | = never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
469 | 28 never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
470 | ; never executed: (*__errno_location ()) = 28 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
471 | return never executed: (return ( (*__errno_location ()) ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
472 | (*__errno_location ()) never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
473 | ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
474 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
475 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||
476 | return executed 72 times by 1 test: 0;return 0; Executed by:
executed 72 times by 1 test: return 0; Executed by:
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||
477 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
479 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
481 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
482 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
483 | here_document_to_fd (redirectee, ri) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
484 | WORD_DESC *redirectee; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
485 | enum r_instruction ri; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
486 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
487 | char *filename; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
488 | int r, fd, fd2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
490 | fd = sh_mktmpfd ("sh-thd", 0x0004|0x0001, &filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
491 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
492 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
493 | if (fd < 0
| 0-105 | ||||||||||||||||||||||||||||||||||||||||||||||||
494 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
495 | do { if (filename
never executed: } while (0);sh_xfree((filename), "redir.c", 464); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
496 | return never executed: (fd);return (fd); never executed: return (fd); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
497 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
499 | (fcntl ((fd), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
500 | 2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
501 | , | - | ||||||||||||||||||||||||||||||||||||||||||||||||
502 | 1 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
503 | )); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
505 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
506 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
507 | = r = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
508 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
509 | if (redirectee->word
| 0-105 | ||||||||||||||||||||||||||||||||||||||||||||||||
510 | r = (
executed 105 times by 1 test: r = (ri != r_reading_string) ? write_here_document (fd, redirectee) : write_here_string (fd, redirectee); Executed by:
| 32-105 | ||||||||||||||||||||||||||||||||||||||||||||||||
511 | : write_here_string (fd, redirectee); executed 105 times by 1 test: r = (ri != r_reading_string) ? write_here_document (fd, redirectee) : write_here_string (fd, redirectee); Executed by:
| 105 | ||||||||||||||||||||||||||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
513 | if (r
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
514 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
515 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
516 | unlink (filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
517 | sh_xfree((filename), "redir.c", 480); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
519 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
520 | = r; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
521 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
522 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
523 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
524 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
525 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
526 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
527 | fd2 = open (filename, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
528 | 00 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
529 | |0, 0600); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
530 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
531 | if (fd2 < 0
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
532 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
533 | r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
534 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
535 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
536 | unlink (filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
537 | sh_xfree((filename), "redir.c", 494); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
538 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
539 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
540 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
541 | = r; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
542 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
543 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
544 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
545 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
546 | if (unlink (filename) < 0
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
547 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
548 | r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
549 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
550 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
551 | close (fd2); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
552 | sh_xfree((filename), "redir.c", 505); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
553 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
554 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
555 | = r; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
556 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
557 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
558 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
559 | sh_xfree((filename), "redir.c", 510); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
560 | return executed 104 times by 1 test: (fd2);return (fd2); Executed by:
executed 104 times by 1 test: return (fd2); Executed by:
| 104 | ||||||||||||||||||||||||||||||||||||||||||||||||
561 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
562 | static STRING_INT_ALIST _redir_special_filenames[] = { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
563 | { "/dev/tcp/*/*", 5 }, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
564 | { "/dev/udp/*/*", 6 }, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
565 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
566 | { (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
567 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
568 | , -1 } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
569 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
570 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
571 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
572 | redir_special_open (spec, filename, flags, mode, ri) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
573 | int spec; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
574 | char *filename; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
575 | int flags, mode; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
576 | enum r_instruction ri; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
577 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
578 | int fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
579 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
580 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
581 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
583 | fd = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
584 | switch (spec) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
585 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
586 | case never executed: 5:case 5: never executed: case 5: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
587 | case never executed: 6:case 6: never executed: case 6: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
589 | if (restricted
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
590 | return never executed: (-3);return (-3); never executed: return (-3); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
591 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
592 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
593 | fd = netopen (filename); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
594 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
595 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
596 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
598 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
600 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
601 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
602 | return never executed: fd;return fd; never executed: return fd; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
603 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
607 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
608 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
609 | noclobber_open (filename, flags, mode, ri) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
610 | char *filename; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
611 | int flags, mode; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
612 | enum r_instruction ri; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
613 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
614 | int r, fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
615 | struct stat finfo, finfo2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
616 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
617 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
619 | r = stat (filename, &finfo); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
620 | if (r == 0
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
621 | ((((
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
622 | finfo.st_mode
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
623 | )) & 0170000) == (0100000))
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
624 | )
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
625 | return executed 19 times by 1 test: (-2);return (-2); Executed by:
executed 19 times by 1 test: return (-2); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
628 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
629 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
630 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
631 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
632 | flags &= ~ | - | ||||||||||||||||||||||||||||||||||||||||||||||||
633 | 01000 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
634 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
635 | if (r != 0
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
636 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
637 | fd = open (filename, flags| | - | ||||||||||||||||||||||||||||||||||||||||||||||||
638 | 0200 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
639 | , mode); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
640 | return executed 19 times by 1 test: ((fd < 0 && return ((fd < 0 && (*__errno_location ()) == 17 ) ? -2 : fd); Executed by:
executed 19 times by 1 test: return ((fd < 0 && (*__errno_location ()) == 17 ) ? -2 : fd); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
641 | (*__errno_location ()) executed 19 times by 1 test: return ((fd < 0 && (*__errno_location ()) == 17 ) ? -2 : fd); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
642 | == executed 19 times by 1 test: return ((fd < 0 && (*__errno_location ()) == 17 ) ? -2 : fd); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
643 | 17 executed 19 times by 1 test: return ((fd < 0 && (*__errno_location ()) == 17 ) ? -2 : fd); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
644 | ) ? -2 : fd); executed 19 times by 1 test: return ((fd < 0 && (*__errno_location ()) == 17 ) ? -2 : fd); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
645 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
646 | fd = open (filename, flags, mode); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
647 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
648 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
649 | if (fd < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
650 | return never executed: (return ( (*__errno_location ()) == 17 ? -2 : fd); never executed: return ( (*__errno_location ()) == 17 ? -2 : fd); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
651 | (*__errno_location ()) never executed: return ( (*__errno_location ()) == 17 ? -2 : fd); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
652 | == never executed: return ( (*__errno_location ()) == 17 ? -2 : fd); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
653 | 17 never executed: return ( (*__errno_location ()) == 17 ? -2 : fd); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
654 | ? -2 : fd); never executed: return ( (*__errno_location ()) == 17 ? -2 : fd); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
655 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
656 | ((((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
657 | finfo2.st_mode
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
658 | )) & 0170000) == (0100000))
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
659 | == 0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
660 | r == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
661 | ((((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
662 | finfo.st_mode
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
663 | )) & 0170000) == (0100000))
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
664 | == 0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
665 | same_file (filename, filename, &finfo, &finfo2)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
666 | return never executed: fd;return fd; never executed: return fd; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
667 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
668 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
669 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
670 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
671 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
672 | = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
673 | 17 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
674 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
675 | return never executed: (-2);return (-2); never executed: return (-2); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
676 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
677 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
678 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
679 | redir_open (filename, flags, mode, ri) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
680 | char *filename; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
681 | int flags, mode; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
682 | enum r_instruction ri; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
683 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
684 | int fd, r, e; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
685 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
686 | r = find_string_in_alist (filename, _redir_special_filenames, 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
687 | if (r >= 0
| 0-666015 | ||||||||||||||||||||||||||||||||||||||||||||||||
688 | return never executed: (redir_special_open (r, filename, flags, mode, ri));return (redir_special_open (r, filename, flags, mode, ri)); never executed: return (redir_special_open (r, filename, flags, mode, ri)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
689 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
690 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
691 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
692 | if (noclobber
| 0-665958 | ||||||||||||||||||||||||||||||||||||||||||||||||
693 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
694 | fd = noclobber_open (filename, flags, mode, ri); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
695 | if (fd == -2
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
696 | return executed 19 times by 1 test: (-2);return (-2); Executed by:
executed 19 times by 1 test: return (-2); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
697 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
698 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
699 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
700 | do | - | ||||||||||||||||||||||||||||||||||||||||||||||||
701 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
702 | fd = open (filename, flags, mode); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
703 | e = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
704 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
705 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
706 | if (fd < 0
| 0-665957 | ||||||||||||||||||||||||||||||||||||||||||||||||
707 | 4
| 0-20 | ||||||||||||||||||||||||||||||||||||||||||||||||
708 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
709 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
710 | do { if (terminating_signal
never executed: if (interrupt_statetermsig_handler (terminating_signal);
never executed: } while (0);throw_to_top_level (); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
711 | run_pending_traps (); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
712 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
713 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
714 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
715 | = e; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
716 | } executed 665977 times by 1 test: end of block Executed by:
| 665977 | ||||||||||||||||||||||||||||||||||||||||||||||||
717 | while (fd < 0
| 20-665957 | ||||||||||||||||||||||||||||||||||||||||||||||||
718 | (*
| 0-20 | ||||||||||||||||||||||||||||||||||||||||||||||||
719 | ==
| 0-20 | ||||||||||||||||||||||||||||||||||||||||||||||||
720 | 4
| 0-20 | ||||||||||||||||||||||||||||||||||||||||||||||||
721 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
722 | } executed 665977 times by 1 test: end of block Executed by:
| 665977 | ||||||||||||||||||||||||||||||||||||||||||||||||
723 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
724 | return executed 665996 times by 1 test: fd;return fd; Executed by:
executed 665996 times by 1 test: return fd; Executed by:
| 665996 | ||||||||||||||||||||||||||||||||||||||||||||||||
725 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
726 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
727 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
728 | undoablefd (fd) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
729 | int fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
730 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
731 | int clexec; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
733 | clexec = fcntl (fd, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
734 | 1 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
735 | , 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
736 | if (clexec == -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
737 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
738 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
739 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
740 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
741 | do_redirection_internal (redirect, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
742 | REDIRECT *redirect; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
743 | int flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
744 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
745 | WORD_DESC *redirectee; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
746 | int redir_fd, fd, redirector, r, oflags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
747 | intmax_t lfd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
748 | char *redirectee_word; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
749 | enum r_instruction ri; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
750 | REDIRECT *new_redirect; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
751 | REDIRECTEE sd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
753 | redirectee = redirect->redirectee.filename; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
754 | redir_fd = redirect->redirectee.dest; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
755 | redirector = redirect->redirector.dest; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
756 | ri = redirect->instruction; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
757 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
758 | if (redirect->flags & 0x08
| 667996-698018 | ||||||||||||||||||||||||||||||||||||||||||||||||
759 | flags |= 0x08; executed 698018 times by 1 test: flags |= 0x08; Executed by:
| 698018 | ||||||||||||||||||||||||||||||||||||||||||||||||
760 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
761 | if ((ri == r_duplicating_input_word
| 3-1365994 | ||||||||||||||||||||||||||||||||||||||||||||||||
762 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
763 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
765 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
766 | redirectee_word = redirection_expand (redirectee); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
767 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
768 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
769 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
770 | if (redirectee_word == 0
| 7-121 | ||||||||||||||||||||||||||||||||||||||||||||||||
771 | return executed 7 times by 1 test: (-1);return (-1); Executed by:
executed 7 times by 1 test: return (-1); Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||
772 | else if (redirectee_word[0] == '-'
| 0-119 | ||||||||||||||||||||||||||||||||||||||||||||||||
773 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
774 | sd = redirect->redirector; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
775 | rd.dest = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
776 | new_redirect = make_redirection (sd, r_close_this, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
777 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
778 | else if (all_digits (redirectee_word)
| 2-117 | ||||||||||||||||||||||||||||||||||||||||||||||||
779 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
780 | sd = redirect->redirector; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
781 | if (legal_number (redirectee_word, &lfd)
| 0-117 | ||||||||||||||||||||||||||||||||||||||||||||||||
782 | rd.dest = lfd; executed 117 times by 1 test: rd.dest = lfd; Executed by:
| 117 | ||||||||||||||||||||||||||||||||||||||||||||||||
783 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
784 | rd.dest = -1; never executed: rd.dest = -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
785 | switch (ri) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
786 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
787 | case executed 18 times by 1 test: r_duplicating_input_word:case r_duplicating_input_word: Executed by:
executed 18 times by 1 test: case r_duplicating_input_word: Executed by:
| 18 | ||||||||||||||||||||||||||||||||||||||||||||||||
788 | new_redirect = make_redirection (sd, r_duplicating_input, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
789 | break; executed 18 times by 1 test: break; Executed by:
| 18 | ||||||||||||||||||||||||||||||||||||||||||||||||
790 | case executed 93 times by 1 test: r_duplicating_output_word:case r_duplicating_output_word: Executed by:
executed 93 times by 1 test: case r_duplicating_output_word: Executed by:
| 93 | ||||||||||||||||||||||||||||||||||||||||||||||||
791 | new_redirect = make_redirection (sd, r_duplicating_output, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
792 | break; executed 93 times by 1 test: break; Executed by:
| 93 | ||||||||||||||||||||||||||||||||||||||||||||||||
793 | case executed 3 times by 1 test: r_move_input_word:case r_move_input_word: Executed by:
executed 3 times by 1 test: case r_move_input_word: Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
794 | new_redirect = make_redirection (sd, r_move_input, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
795 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
796 | case executed 3 times by 1 test: r_move_output_word:case r_move_output_word: Executed by:
executed 3 times by 1 test: case r_move_output_word: Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
797 | new_redirect = make_redirection (sd, r_move_output, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
798 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
799 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
800 | } executed 117 times by 1 test: end of block Executed by:
| 117 | ||||||||||||||||||||||||||||||||||||||||||||||||
801 | else if (ri == r_duplicating_output_word
| 0-2 | ||||||||||||||||||||||||||||||||||||||||||||||||
802 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
803 | sd = redirect->redirector; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
804 | rd.filename = make_bare_word (redirectee_word); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
805 | new_redirect = make_redirection (sd, r_err_and_out, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
806 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
807 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
808 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
809 | sh_xfree((redirectee_word), "redir.c", 788); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
810 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
811 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
813 | sh_xfree((redirectee_word), "redir.c", 792); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
814 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
815 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
817 | if (new_redirect->instruction == r_err_and_out
| 2-119 | ||||||||||||||||||||||||||||||||||||||||||||||||
818 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
819 | char *alloca_hack; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
820 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
821 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
822 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
823 | redirectee = (WORD_DESC *)__builtin_alloca (sizeof (WORD_DESC)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
824 | xbcopy ((char *)new_redirect->redirectee.filename, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
825 | (char *)redirectee, sizeof (WORD_DESC)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
826 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
827 | alloca_hack = (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
828 | __builtin_alloca (1 + strlen (new_redirect->redirectee.filename->word)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
829 | redirectee->word = alloca_hack; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
830 | strcpy (redirectee->word, new_redirect->redirectee.filename->word); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
831 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
832 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
834 | redirectee = new_redirect->redirectee.filename; executed 119 times by 1 test: redirectee = new_redirect->redirectee.filename; Executed by:
| 119 | ||||||||||||||||||||||||||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
836 | redir_fd = new_redirect->redirectee.dest; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
837 | redirector = new_redirect->redirector.dest; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
838 | ri = new_redirect->instruction; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
839 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
840 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
841 | redirect->flags = new_redirect->flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
842 | dispose_redirects (new_redirect); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
843 | } executed 121 times by 1 test: end of block Executed by:
| 121 | ||||||||||||||||||||||||||||||||||||||||||||||||
844 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
845 | switch (ri) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
846 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
847 | case executed 4022 times by 1 test: r_output_direction:case r_output_direction: Executed by:
executed 4022 times by 1 test: case r_output_direction: Executed by:
| 4022 | ||||||||||||||||||||||||||||||||||||||||||||||||
848 | case executed 15 times by 1 test: r_appending_to:case r_appending_to: Executed by:
executed 15 times by 1 test: case r_appending_to: Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||
849 | case executed 663287 times by 1 test: r_input_direction:case r_input_direction: Executed by:
executed 663287 times by 1 test: case r_input_direction: Executed by:
| 663287 | ||||||||||||||||||||||||||||||||||||||||||||||||
850 | case never executed: r_inputa_direction:case r_inputa_direction: never executed: case r_inputa_direction: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
851 | case executed 17 times by 1 test: r_err_and_out:case r_err_and_out: Executed by:
executed 17 times by 1 test: case r_err_and_out: Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||||||||||||||
852 | case executed 2 times by 1 test: r_append_err_and_out:case r_append_err_and_out: Executed by:
executed 2 times by 1 test: case r_append_err_and_out: Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
853 | case executed 18 times by 1 test: r_input_output:case r_input_output: Executed by:
executed 18 times by 1 test: case r_input_output: Executed by:
| 18 | ||||||||||||||||||||||||||||||||||||||||||||||||
854 | case executed 19 times by 1 test: r_output_force:case r_output_force: Executed by:
executed 19 times by 1 test: case r_output_force: Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
855 | if (posixly_correct
| 0-667368 | ||||||||||||||||||||||||||||||||||||||||||||||||
856 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
857 | oflags = redirectee->flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
858 | redirectee->flags |= 0x000020; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
859 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
860 | redirectee_word = redirection_expand (redirectee); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
861 | if (posixly_correct
| 0-666006 | ||||||||||||||||||||||||||||||||||||||||||||||||
862 | redirectee->flags = oflags; executed 12 times by 1 test: redirectee->flags = oflags; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
864 | if (redirectee_word == 0
| 1-666017 | ||||||||||||||||||||||||||||||||||||||||||||||||
865 | return executed 1 time by 1 test: (-1);return (-1); Executed by:
executed 1 time by 1 test: return (-1); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
868 | if (restricted
| 0-666015 | ||||||||||||||||||||||||||||||||||||||||||||||||
869 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
870 | sh_xfree((redirectee_word), "redir.c", 849); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
871 | return executed 2 times by 1 test: (-3);return (-3); Executed by:
executed 2 times by 1 test: return (-3); Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
872 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
873 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
874 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
875 | fd = redir_open (redirectee_word, redirect->flags, 0666, ri); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
876 | sh_xfree((redirectee_word), "redir.c", 855); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
878 | if (fd == -2
| 0-665996 | ||||||||||||||||||||||||||||||||||||||||||||||||
879 | return executed 19 times by 1 test: (fd);return (fd); Executed by:
executed 19 times by 1 test: return (fd); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
881 | if (fd < 0
| 20-665976 | ||||||||||||||||||||||||||||||||||||||||||||||||
882 | return executed 20 times by 1 test: (return ( (*__errno_location ()) ); Executed by:
executed 20 times by 1 test: return ( (*__errno_location ()) ); Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
883 | (*__errno_location ()) executed 20 times by 1 test: return ( (*__errno_location ()) ); Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
884 | ); executed 20 times by 1 test: return ( (*__errno_location ()) ); Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
886 | if (flags & 0x01
| 0-665976 | ||||||||||||||||||||||||||||||||||||||||||||||||
887 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
888 | if (redirect->rflags & 0x01
| 13-665963 | ||||||||||||||||||||||||||||||||||||||||||||||||
889 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
890 | redirector = fcntl (fd, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
891 | 0 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
892 | , 10); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
893 | r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
894 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
895 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
896 | if (redirector < 0
| 1-12 | ||||||||||||||||||||||||||||||||||||||||||||||||
897 | sys_error ( executed 1 time by 1 test: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
898 | dcgettext (((void *)0), executed 1 time by 1 test: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
899 | "redirection error: cannot duplicate fd" executed 1 time by 1 test: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
900 | , 5) executed 1 time by 1 test: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
901 | ); executed 1 time by 1 test: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
902 | do { if ((
executed 1 time by 1 test: last_command_exit_value = 1; returnclose (fd); Executed by:
executed 1 time by 1 test: ((r) == 0 ? return ((r) == 0 ? 22 : (r)); Executed by:
executed 1 time by 1 test: return ((r) == 0 ? 22 : (r)); Executed by:
| 0-12 | ||||||||||||||||||||||||||||||||||||||||||||||||
903 | 22 executed 1 time by 1 test: return ((r) == 0 ? 22 : (r)); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
904 | : (r)); executed 1 time by 1 test: } } while (0);return ((r) == 0 ? 22 : (r)); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
905 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
906 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
907 | if ((
| 11-665952 | ||||||||||||||||||||||||||||||||||||||||||||||||
908 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
910 | if ((
| 24-634573 | ||||||||||||||||||||||||||||||||||||||||||||||||
911 | 1
| 24-31344 | ||||||||||||||||||||||||||||||||||||||||||||||||
912 | , 0) != -1)
| 24-31344 | ||||||||||||||||||||||||||||||||||||||||||||||||
913 | r = add_undo_redirect (redirector, ri, -1); executed 31344 times by 1 test: r = add_undo_redirect (redirector, ri, -1); Executed by:
| 31344 | ||||||||||||||||||||||||||||||||||||||||||||||||
914 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
915 | r = add_undo_close_redirect (redirector); executed 634597 times by 1 test: r = add_undo_close_redirect (redirector); Executed by:
| 634597 | ||||||||||||||||||||||||||||||||||||||||||||||||
916 | do { if ((
never executed: last_command_exit_value = 1; returnclose (fd); never executed: ((return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0-665941 | ||||||||||||||||||||||||||||||||||||||||||||||||
917 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
918 | ) == 0 ? never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
919 | 22 never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
920 | : ( never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
921 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
922 | )); never executed: } } while (0);return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
923 | } executed 665941 times by 1 test: end of block Executed by:
| 665941 | ||||||||||||||||||||||||||||||||||||||||||||||||
924 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
925 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
926 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
927 | if (redirector != 0
| 0-664719 | ||||||||||||||||||||||||||||||||||||||||||||||||
928 | check_bash_input (redirector); executed 665975 times by 1 test: check_bash_input (redirector); Executed by:
| 665975 | ||||||||||||||||||||||||||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
931 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
932 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
934 | if (redirector == 1
| 0-665674 | ||||||||||||||||||||||||||||||||||||||||||||||||
935 | stdout
| 0-301 | ||||||||||||||||||||||||||||||||||||||||||||||||
936 | ) == redirector
| 0-301 | ||||||||||||||||||||||||||||||||||||||||||||||||
937 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
938 | fflush ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
939 | stdout | - | ||||||||||||||||||||||||||||||||||||||||||||||||
940 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
941 | fpurge ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
942 | stdout | - | ||||||||||||||||||||||||||||||||||||||||||||||||
943 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
944 | } executed 301 times by 1 test: end of block Executed by:
| 301 | ||||||||||||||||||||||||||||||||||||||||||||||||
945 | else if (redirector == 2
| 0-661975 | ||||||||||||||||||||||||||||||||||||||||||||||||
946 | stderr
| 0-3699 | ||||||||||||||||||||||||||||||||||||||||||||||||
947 | ) == redirector
| 0-3699 | ||||||||||||||||||||||||||||||||||||||||||||||||
948 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
949 | fflush ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
950 | stderr | - | ||||||||||||||||||||||||||||||||||||||||||||||||
951 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
952 | fpurge ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
953 | stderr | - | ||||||||||||||||||||||||||||||||||||||||||||||||
954 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
955 | } executed 3699 times by 1 test: end of block Executed by:
| 3699 | ||||||||||||||||||||||||||||||||||||||||||||||||
956 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
957 | if (redirect->rflags & 0x01
| 12-665963 | ||||||||||||||||||||||||||||||||||||||||||||||||
958 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
959 | if ((
| 5-7 | ||||||||||||||||||||||||||||||||||||||||||||||||
960 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
961 | close (redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
962 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
963 | return executed 7 times by 1 test: (r);return (r); Executed by:
executed 7 times by 1 test: return (r); Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||
964 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
965 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||
966 | else if ((
| 0-634573 | ||||||||||||||||||||||||||||||||||||||||||||||||
967 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
968 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
969 | return never executed: (return ( (*__errno_location ()) ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
970 | (*__errno_location ()) never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
971 | ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
972 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
973 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
974 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
975 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
976 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
977 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
978 | if (ri == r_input_direction
| 18-661909 | ||||||||||||||||||||||||||||||||||||||||||||||||
979 | duplicate_buffered_stream (fd, redirector); executed 661927 times by 1 test: duplicate_buffered_stream (fd, redirector); Executed by:
| 661927 | ||||||||||||||||||||||||||||||||||||||||||||||||
980 | if ((
| 0-665968 | ||||||||||||||||||||||||||||||||||||||||||||||||
981 | ( never executed: fcntl ((redirector), (fcntl ((redirector), 2 , 1 )); never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
982 | 2 never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
983 | , never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
984 | 1 never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
985 | )); never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
986 | } executed 665968 times by 1 test: end of block Executed by:
| 665968 | ||||||||||||||||||||||||||||||||||||||||||||||||
987 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
988 | if (fd != redirector
| 31395-634573 | ||||||||||||||||||||||||||||||||||||||||||||||||
989 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
990 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
991 | if ((ri == r_input_direction
| 0-27390 | ||||||||||||||||||||||||||||||||||||||||||||||||
992 | close_buffered_fd (fd); executed 27390 times by 1 test: close_buffered_fd (fd); Executed by:
| 27390 | ||||||||||||||||||||||||||||||||||||||||||||||||
993 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
994 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
995 | close (fd); executed 4005 times by 1 test: close (fd); Executed by:
| 4005 | ||||||||||||||||||||||||||||||||||||||||||||||||
996 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
997 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
998 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
999 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1000 | if (ri == r_err_and_out
| 2-665951 | ||||||||||||||||||||||||||||||||||||||||||||||||
1001 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1002 | if (flags & 0x01
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
1003 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1004 | if (flags & 0x02
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
1005 | add_undo_redirect (2, ri, -1); executed 19 times by 1 test: add_undo_redirect (2, ri, -1); Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
1006 | if (dup2 (1, 2) < 0
| 0-19 | ||||||||||||||||||||||||||||||||||||||||||||||||
1007 | return never executed: (return ( (*__errno_location ()) ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1008 | (*__errno_location ()) never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1009 | ); never executed: return ( (*__errno_location ()) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1010 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
1011 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||||||||||||||||||||||||||||||||||||||
1012 | break; executed 665968 times by 1 test: break; Executed by:
| 665968 | ||||||||||||||||||||||||||||||||||||||||||||||||
1013 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1014 | case executed 73 times by 1 test: r_reading_until:case r_reading_until: Executed by:
executed 73 times by 1 test: case r_reading_until: Executed by:
| 73 | ||||||||||||||||||||||||||||||||||||||||||||||||
1015 | case never executed: r_deblank_reading_until:case r_deblank_reading_until: never executed: case r_deblank_reading_until: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1016 | case executed 32 times by 1 test: r_reading_string:case r_reading_string: Executed by:
executed 32 times by 1 test: case r_reading_string: Executed by:
| 32 | ||||||||||||||||||||||||||||||||||||||||||||||||
1017 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1018 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1019 | if (redirectee
| 0-105 | ||||||||||||||||||||||||||||||||||||||||||||||||
1020 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1021 | fd = here_document_to_fd (redirectee, ri); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1022 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1023 | if (fd < 0
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1024 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1025 | heredoc_errno = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1026 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1027 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1028 | return never executed: (-4);return (-4); never executed: return (-4); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1029 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1030 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1031 | if (redirect->rflags & 0x01
| 1-103 | ||||||||||||||||||||||||||||||||||||||||||||||||
1032 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1033 | redirector = fcntl (fd, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1034 | 0 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1035 | , 10); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1036 | r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1037 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1038 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1039 | if (redirector < 0
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1040 | sys_error ( never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1041 | dcgettext (((void *)0), never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1042 | "redirection error: cannot duplicate fd" never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1043 | , 5) never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1044 | ); never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1045 | do { if ((
never executed: last_command_exit_value = 1; returnclose (fd); never executed: ((r) == 0 ? return ((r) == 0 ? 22 : (r)); never executed: return ((r) == 0 ? 22 : (r)); | 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1046 | 22 never executed: return ((r) == 0 ? 22 : (r)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1047 | : (r)); never executed: } } while (0);return ((r) == 0 ? 22 : (r)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1048 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1049 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1050 | if (flags & 0x01
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1051 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1052 | if ((
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1053 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1054 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1055 | if ((
| 0-103 | ||||||||||||||||||||||||||||||||||||||||||||||||
1056 | 1
| 2-101 | ||||||||||||||||||||||||||||||||||||||||||||||||
1057 | , 0) != -1)
| 2-101 | ||||||||||||||||||||||||||||||||||||||||||||||||
1058 | r = add_undo_redirect (redirector, ri, -1); executed 101 times by 1 test: r = add_undo_redirect (redirector, ri, -1); Executed by:
| 101 | ||||||||||||||||||||||||||||||||||||||||||||||||
1059 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1060 | r = add_undo_close_redirect (redirector); executed 2 times by 1 test: r = add_undo_close_redirect (redirector); Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
1061 | do { if ((
never executed: last_command_exit_value = 1; returnclose (fd); never executed: ((return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0-103 | ||||||||||||||||||||||||||||||||||||||||||||||||
1062 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1063 | ) == 0 ? never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1064 | 22 never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1065 | : ( never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1066 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1067 | )); never executed: } } while (0);return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1068 | } executed 103 times by 1 test: end of block Executed by:
| 103 | ||||||||||||||||||||||||||||||||||||||||||||||||
1069 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1070 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1071 | check_bash_input (redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1072 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1073 | if (redirect->rflags & 0x01
| 1-103 | ||||||||||||||||||||||||||||||||||||||||||||||||
1074 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1075 | if ((
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1076 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1077 | close (redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1078 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1079 | return never executed: (r);return (r); never executed: return (r); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1080 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1081 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1082 | else if (fd != redirector
| 0-103 | ||||||||||||||||||||||||||||||||||||||||||||||||
1083 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1084 | r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1085 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1086 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1087 | close (fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1088 | return never executed: (r);return (r); never executed: return (r); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1089 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1090 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1091 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1092 | duplicate_buffered_stream (fd, redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1093 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1094 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1095 | if ((
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1096 | ( never executed: fcntl ((redirector), (fcntl ((redirector), 2 , 1 )); never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1097 | 2 never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1098 | , never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1099 | 1 never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1100 | )); never executed: (fcntl ((redirector), 2 , 1 )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1101 | } executed 104 times by 1 test: end of block Executed by:
| 104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1102 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1103 | if (fd != redirector
| 0-104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1104 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1105 | close_buffered_fd (fd); executed 104 times by 1 test: close_buffered_fd (fd); Executed by:
| 104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1106 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1107 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1108 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1109 | } executed 104 times by 1 test: end of block Executed by:
| 104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1110 | break; executed 104 times by 1 test: break; Executed by:
| 104 | ||||||||||||||||||||||||||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1112 | case executed 1389 times by 1 test: r_duplicating_input:case r_duplicating_input: Executed by:
executed 1389 times by 1 test: case r_duplicating_input: Executed by:
| 1389 | ||||||||||||||||||||||||||||||||||||||||||||||||
1113 | case executed 30682 times by 1 test: r_duplicating_output:case r_duplicating_output: Executed by:
executed 30682 times by 1 test: case r_duplicating_output: Executed by:
| 30682 | ||||||||||||||||||||||||||||||||||||||||||||||||
1114 | case executed 5 times by 1 test: r_move_input:case r_move_input: Executed by:
executed 5 times by 1 test: case r_move_input: Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||
1115 | case executed 3 times by 1 test: r_move_output:case r_move_output: Executed by:
executed 3 times by 1 test: case r_move_output: Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
1116 | if ((
| 0-32079 | ||||||||||||||||||||||||||||||||||||||||||||||||
1117 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1118 | redirector = fcntl (redir_fd, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1119 | 0 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1120 | , 10); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1121 | r = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1122 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1123 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1124 | if (redirector < 0
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||
1125 | sys_error ( never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1126 | dcgettext (((void *)0), never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1127 | "redirection error: cannot duplicate fd" never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1128 | , 5) never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1129 | ); never executed: sys_error ( dcgettext (((void *)0), "redirection error: cannot duplicate fd" , 5) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1130 | do { if ((
never executed: last_command_exit_value = 1; returnclose (-1); never executed: ((r) == 0 ? return ((r) == 0 ? 22 : (r)); never executed: return ((r) == 0 ? 22 : (r)); | 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||
1131 | 22 never executed: return ((r) == 0 ? 22 : (r)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1132 | : (r)); never executed: } } while (0);return ((r) == 0 ? 22 : (r)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1133 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||
1134 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1135 | if ((
| 0-32079 | ||||||||||||||||||||||||||||||||||||||||||||||||
1136 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1137 | if ((
| 11-31695 | ||||||||||||||||||||||||||||||||||||||||||||||||
1138 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1139 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1140 | if (fcntl (redirector,
| 20-353 | ||||||||||||||||||||||||||||||||||||||||||||||||
1141 | 1
| 20-353 | ||||||||||||||||||||||||||||||||||||||||||||||||
1142 | , 0) != -1
| 20-353 | ||||||||||||||||||||||||||||||||||||||||||||||||
1143 | r = add_undo_redirect (redirector, ri, redir_fd); executed 353 times by 1 test: r = add_undo_redirect (redirector, ri, redir_fd); Executed by:
| 353 | ||||||||||||||||||||||||||||||||||||||||||||||||
1144 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1145 | r = add_undo_close_redirect (redirector); executed 20 times by 1 test: r = add_undo_close_redirect (redirector); Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
1146 | do { if ((
never executed: last_command_exit_value = 1; returnclose (-1); never executed: ((return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0-373 | ||||||||||||||||||||||||||||||||||||||||||||||||
1147 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1148 | ) == 0 ? never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1149 | 22 never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1150 | : ( never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1151 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1152 | )); never executed: } } while (0);return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1153 | } executed 373 times by 1 test: end of block Executed by:
| 373 | ||||||||||||||||||||||||||||||||||||||||||||||||
1154 | if ((
| 3-31695 | ||||||||||||||||||||||||||||||||||||||||||||||||
1155 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1156 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1157 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1158 | if (fcntl (redirector,
| 2-6 | ||||||||||||||||||||||||||||||||||||||||||||||||
1159 | 1
| 2-6 | ||||||||||||||||||||||||||||||||||||||||||||||||
1160 | , 0) != -1
| 2-6 | ||||||||||||||||||||||||||||||||||||||||||||||||
1161 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1162 | r = add_undo_redirect (redir_fd, r_close_this, -1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1163 | do { if ((
never executed: last_command_exit_value = 1; returnclose (-1); never executed: ((return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0-6 | ||||||||||||||||||||||||||||||||||||||||||||||||
1164 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1165 | ) == 0 ? never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1166 | 22 never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1167 | : ( never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1168 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1169 | )); never executed: } } while (0);return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1170 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
1171 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
1172 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1173 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1174 | if (redirector != 0
| 0-30700 | ||||||||||||||||||||||||||||||||||||||||||||||||
1175 | check_bash_input (redirector); executed 32079 times by 1 test: check_bash_input (redirector); Executed by:
| 32079 | ||||||||||||||||||||||||||||||||||||||||||||||||
1176 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1177 | if (redirect->rflags & 0x01
| 11-32068 | ||||||||||||||||||||||||||||||||||||||||||||||||
1178 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1179 | if ((
| 0-11 | ||||||||||||||||||||||||||||||||||||||||||||||||
1180 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1181 | close (redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1182 | return never executed: (r);return (r); never executed: return (r); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1183 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1184 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||
1185 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1186 | else if (dup2 (redir_fd, redirector) < 0
| 55-32013 | ||||||||||||||||||||||||||||||||||||||||||||||||
1187 | return executed 55 times by 1 test: (return ( (*__errno_location ()) ); Executed by:
executed 55 times by 1 test: return ( (*__errno_location ()) ); Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||
1188 | (*__errno_location ()) executed 55 times by 1 test: return ( (*__errno_location ()) ); Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||
1189 | ); executed 55 times by 1 test: return ( (*__errno_location ()) ); Executed by:
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||
1190 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1191 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1192 | if (ri == r_duplicating_input
| 5-30635 | ||||||||||||||||||||||||||||||||||||||||||||||||
1193 | duplicate_buffered_stream (redir_fd, redirector); executed 1394 times by 1 test: duplicate_buffered_stream (redir_fd, redirector); Executed by:
| 1394 | ||||||||||||||||||||||||||||||||||||||||||||||||
1194 | if (((
| 327-31697 | ||||||||||||||||||||||||||||||||||||||||||||||||
1195 | 1
| 327-31697 | ||||||||||||||||||||||||||||||||||||||||||||||||
1196 | , 0) == 1)
| 0-31697 | ||||||||||||||||||||||||||||||||||||||||||||||||
1197 | (
| 5585-26112 | ||||||||||||||||||||||||||||||||||||||||||||||||
1198 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1199 | ( executed 26112 times by 1 test: fcntl ((redirector), (fcntl ((redirector), 2 , 1 )); Executed by:
executed 26112 times by 1 test: (fcntl ((redirector), 2 , 1 )); Executed by:
| 26112 | ||||||||||||||||||||||||||||||||||||||||||||||||
1200 | 2 executed 26112 times by 1 test: (fcntl ((redirector), 2 , 1 )); Executed by:
| 26112 | ||||||||||||||||||||||||||||||||||||||||||||||||
1201 | , executed 26112 times by 1 test: (fcntl ((redirector), 2 , 1 )); Executed by:
| 26112 | ||||||||||||||||||||||||||||||||||||||||||||||||
1202 | 1 executed 26112 times by 1 test: (fcntl ((redirector), 2 , 1 )); Executed by:
| 26112 | ||||||||||||||||||||||||||||||||||||||||||||||||
1203 | )); executed 26112 times by 1 test: (fcntl ((redirector), 2 , 1 )); Executed by:
| 26112 | ||||||||||||||||||||||||||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1206 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1207 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1208 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1209 | if ((
| 0-31685 | ||||||||||||||||||||||||||||||||||||||||||||||||
1210 | ( executed 26110 times by 1 test: fcntl ((redirector), (fcntl ((redirector), 2 , 0)); Executed by:
executed 26110 times by 1 test: (fcntl ((redirector), 2 , 0)); Executed by:
| 26110 | ||||||||||||||||||||||||||||||||||||||||||||||||
1211 | 2 executed 26110 times by 1 test: (fcntl ((redirector), 2 , 0)); Executed by:
| 26110 | ||||||||||||||||||||||||||||||||||||||||||||||||
1212 | , 0)); executed 26110 times by 1 test: (fcntl ((redirector), 2 , 0)); Executed by:
| 26110 | ||||||||||||||||||||||||||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1215 | if (ri == r_move_input
| 3-32019 | ||||||||||||||||||||||||||||||||||||||||||||||||
1216 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1217 | xtrace_fdchk (redir_fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1218 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1219 | close (redir_fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1220 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1221 | coproc_fdchk (redir_fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1222 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1223 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||||||||||||||||||||
1224 | } executed 32024 times by 1 test: end of block Executed by:
| 32024 | ||||||||||||||||||||||||||||||||||||||||||||||||
1225 | break; executed 32024 times by 1 test: break; Executed by:
| 32024 | ||||||||||||||||||||||||||||||||||||||||||||||||
1226 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1227 | case executed 666433 times by 1 test: r_close_this:case r_close_this: Executed by:
executed 666433 times by 1 test: case r_close_this: Executed by:
| 666433 | ||||||||||||||||||||||||||||||||||||||||||||||||
1228 | if (flags & 0x01
| 0-666433 | ||||||||||||||||||||||||||||||||||||||||||||||||
1229 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1230 | if (redirect->rflags & 0x01
| 5-666428 | ||||||||||||||||||||||||||||||||||||||||||||||||
1231 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1232 | redirector = redir_varvalue (redirect); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1233 | if (redirector < 0
| 1-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1234 | return executed 1 time by 1 test: -1;return -1; Executed by:
executed 1 time by 1 test: return -1; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1235 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1236 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1237 | r = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1238 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1239 | if ((
| 2-666382 | ||||||||||||||||||||||||||||||||||||||||||||||||
1240 | 1
| 2-48 | ||||||||||||||||||||||||||||||||||||||||||||||||
1241 | , 0) != -1)
| 2-48 | ||||||||||||||||||||||||||||||||||||||||||||||||
1242 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1243 | r = add_undo_redirect (redirector, ri, -1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1244 | do { if ((
never executed: last_command_exit_value = 1; returnclose (redirector); never executed: ((return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0-48 | ||||||||||||||||||||||||||||||||||||||||||||||||
1245 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1246 | ) == 0 ? never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1247 | 22 never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1248 | : ( never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1249 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1250 | )); never executed: } } while (0);return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1251 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||||||||
1252 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1253 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1254 | coproc_fdchk (redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1255 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1256 | xtrace_fdchk (redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1257 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1259 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1260 | if (redirector != 0
| 0-666431 | ||||||||||||||||||||||||||||||||||||||||||||||||
1261 | check_bash_input (redirector); executed 666432 times by 1 test: check_bash_input (redirector); Executed by:
| 666432 | ||||||||||||||||||||||||||||||||||||||||||||||||
1262 | r = close_buffered_fd (redirector); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1263 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1264 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1265 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1266 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1267 | if (r < 0
| 0-666430 | ||||||||||||||||||||||||||||||||||||||||||||||||
1268 | (*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1269 | ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1270 | 5
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1271 | || | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1272 | (*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1273 | ==
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1274 | 28
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1275 | )) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1276 | do { if ((
never executed: last_command_exit_value = 1; returnclose (-1); never executed: ((return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1277 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1278 | ) == 0 ? never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1279 | 22 never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1280 | : ( never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1281 | (*__errno_location ()) never executed: return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1282 | )); never executed: } }return (( (*__errno_location ()) ) == 0 ? 22 : ( (*__errno_location ()) )); never executed: while (0);end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1283 | } executed 666432 times by 1 test: end of block Executed by:
| 666432 | ||||||||||||||||||||||||||||||||||||||||||||||||
1284 | break; executed 666432 times by 1 test: break; Executed by:
| 666432 | ||||||||||||||||||||||||||||||||||||||||||||||||
1285 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1286 | case never executed: r_duplicating_input_word:case r_duplicating_input_word: never executed: case r_duplicating_input_word: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1287 | case never executed: r_duplicating_output_word:case r_duplicating_output_word: never executed: case r_duplicating_output_word: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1288 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1289 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1290 | return executed 1364528 times by 1 test: (0);return (0); Executed by:
executed 1364528 times by 1 test: return (0); Executed by:
| 1364528 | ||||||||||||||||||||||||||||||||||||||||||||||||
1291 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1292 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1293 | add_undo_redirect (fd, ri, fdbase) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1294 | int fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1295 | enum r_instruction ri; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1296 | int fdbase; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1297 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1298 | int new_fd, clexec_flag, savefd_flag; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1299 | REDIRECT *new_redirect, *closer, *dummy_redirect; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1300 | REDIRECTEE sd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1301 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1302 | savefd_flag = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1303 | new_fd = fcntl (fd, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1304 | 0 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1305 | , (fdbase < 10) ? 10 : fdbase+1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1306 | if (new_fd < 0
| 1-31870 | ||||||||||||||||||||||||||||||||||||||||||||||||
1307 | new_fd = fcntl (fd, executed 1 time by 1 test: new_fd = fcntl (fd, 0 , 10); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1308 | 0 executed 1 time by 1 test: new_fd = fcntl (fd, 0 , 10); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1309 | , 10); executed 1 time by 1 test: new_fd = fcntl (fd, 0 , 10); Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1310 | if (new_fd < 0
| 1-31870 | ||||||||||||||||||||||||||||||||||||||||||||||||
1311 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1312 | new_fd = fcntl (fd, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1313 | 0 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1314 | , 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1315 | savefd_flag = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1316 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1317 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1318 | if (new_fd < 0
| 0-31871 | ||||||||||||||||||||||||||||||||||||||||||||||||
1319 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1320 | sys_error ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1321 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1322 | "redirection error: cannot duplicate fd" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1323 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1324 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1325 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1326 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1327 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1328 | clexec_flag = fcntl (fd, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1329 | 1 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1330 | , 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1331 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1332 | sd.dest = new_fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1333 | rd.dest = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1334 | closer = make_redirection (sd, r_close_this, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1335 | closer->flags |= 0x08; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1336 | dummy_redirect = copy_redirects (closer); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1337 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1338 | sd.dest = fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1339 | rd.dest = new_fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1340 | if (fd == 0
| 1391-30480 | ||||||||||||||||||||||||||||||||||||||||||||||||
1341 | new_redirect = make_redirection (sd, r_duplicating_input, rd, 0); executed 1391 times by 1 test: new_redirect = make_redirection (sd, r_duplicating_input, rd, 0); Executed by:
| 1391 | ||||||||||||||||||||||||||||||||||||||||||||||||
1342 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1343 | new_redirect = make_redirection (sd, r_duplicating_output, rd, 0); executed 30480 times by 1 test: new_redirect = make_redirection (sd, r_duplicating_output, rd, 0); Executed by:
| 30480 | ||||||||||||||||||||||||||||||||||||||||||||||||
1344 | new_redirect->flags |= 0x08; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1345 | if (savefd_flag
| 1-31870 | ||||||||||||||||||||||||||||||||||||||||||||||||
1346 | new_redirect->flags |= 0x40; executed 1 time by 1 test: new_redirect->flags |= 0x40; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1347 | if (clexec_flag == 0
| 0-31869 | ||||||||||||||||||||||||||||||||||||||||||||||||
1348 | new_redirect->flags |= 0x20; executed 26200 times by 1 test: new_redirect->flags |= 0x20; Executed by:
| 26200 | ||||||||||||||||||||||||||||||||||||||||||||||||
1349 | new_redirect->next = closer; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1350 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1351 | closer->next = redirection_undo_list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1352 | redirection_undo_list = new_redirect; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1353 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1354 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1355 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1356 | add_exec_redirect (dummy_redirect); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1357 | if (fd >= 10
| 1-31839 | ||||||||||||||||||||||||||||||||||||||||||||||||
1358 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1359 | sd.dest = fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1360 | rd.dest = new_fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1361 | new_redirect = make_redirection (sd, r_duplicating_output, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1362 | new_redirect->flags |= 0x08; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1363 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1364 | add_exec_redirect (new_redirect); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1365 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1366 | if (clexec_flag
| 2-31869 | ||||||||||||||||||||||||||||||||||||||||||||||||
1367 | ( executed 5671 times by 1 test: fcntl ((new_fd), (fcntl ((new_fd), 2 , 1 )); Executed by:
executed 5671 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 5671 | ||||||||||||||||||||||||||||||||||||||||||||||||
1368 | 2 executed 5671 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 5671 | ||||||||||||||||||||||||||||||||||||||||||||||||
1369 | , executed 5671 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 5671 | ||||||||||||||||||||||||||||||||||||||||||||||||
1370 | 1 executed 5671 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 5671 | ||||||||||||||||||||||||||||||||||||||||||||||||
1371 | )); executed 5671 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 5671 | ||||||||||||||||||||||||||||||||||||||||||||||||
1372 | else if (redirection_undo_list->flags & 0x20
| 0-26200 | ||||||||||||||||||||||||||||||||||||||||||||||||
1373 | ( executed 26200 times by 1 test: fcntl ((new_fd), (fcntl ((new_fd), 2 , 1 )); Executed by:
executed 26200 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 26200 | ||||||||||||||||||||||||||||||||||||||||||||||||
1374 | 2 executed 26200 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 26200 | ||||||||||||||||||||||||||||||||||||||||||||||||
1375 | , executed 26200 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 26200 | ||||||||||||||||||||||||||||||||||||||||||||||||
1376 | 1 executed 26200 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 26200 | ||||||||||||||||||||||||||||||||||||||||||||||||
1377 | )); executed 26200 times by 1 test: (fcntl ((new_fd), 2 , 1 )); Executed by:
| 26200 | ||||||||||||||||||||||||||||||||||||||||||||||||
1378 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1379 | return executed 31871 times by 1 test: (0);return (0); Executed by:
executed 31871 times by 1 test: return (0); Executed by:
| 31871 | ||||||||||||||||||||||||||||||||||||||||||||||||
1380 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1381 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1382 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1383 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1384 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1385 | add_undo_close_redirect (fd) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1386 | int fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1387 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1388 | REDIRECT *closer; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1389 | REDIRECTEE sd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1390 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1391 | sd.dest = fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1392 | rd.dest = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1393 | closer = make_redirection (sd, r_close_this, rd, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1394 | closer->flags |= 0x08; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1395 | closer->next = redirection_undo_list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1396 | redirection_undo_list = closer; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1397 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1398 | return executed 634619 times by 1 test: 0;return 0; Executed by:
executed 634619 times by 1 test: return 0; Executed by:
| 634619 | ||||||||||||||||||||||||||||||||||||||||||||||||
1399 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1400 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1401 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1402 | add_exec_redirect (dummy_redirect) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1403 | REDIRECT *dummy_redirect; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1404 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1405 | dummy_redirect->next = exec_redirection_undo_list; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1406 | exec_redirection_undo_list = dummy_redirect; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1407 | } executed 31872 times by 1 test: end of block Executed by:
| 31872 | ||||||||||||||||||||||||||||||||||||||||||||||||
1408 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1409 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1410 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1411 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1412 | stdin_redirection (ri, redirector) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1413 | enum r_instruction ri; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1414 | int redirector; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1415 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1416 | switch (ri) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1417 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1418 | case executed 661960 times by 1 test: r_input_direction:case r_input_direction: Executed by:
executed 661960 times by 1 test: case r_input_direction: Executed by:
| 661960 | ||||||||||||||||||||||||||||||||||||||||||||||||
1419 | case never executed: r_inputa_direction:case r_inputa_direction: never executed: case r_inputa_direction: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1420 | case never executed: r_input_output:case r_input_output: never executed: case r_input_output: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1421 | case executed 43 times by 1 test: r_reading_until:case r_reading_until: Executed by:
executed 43 times by 1 test: case r_reading_until: Executed by:
| 43 | ||||||||||||||||||||||||||||||||||||||||||||||||
1422 | case never executed: r_deblank_reading_until:case r_deblank_reading_until: never executed: case r_deblank_reading_until: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1423 | case executed 14 times by 1 test: r_reading_string:case r_reading_string: Executed by:
executed 14 times by 1 test: case r_reading_string: Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||||||||||||||
1424 | return executed 662017 times by 1 test: (1);return (1); Executed by:
executed 662017 times by 1 test: return (1); Executed by:
| 662017 | ||||||||||||||||||||||||||||||||||||||||||||||||
1425 | case never executed: r_duplicating_input:case r_duplicating_input: never executed: case r_duplicating_input: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1426 | case never executed: r_duplicating_input_word:case r_duplicating_input_word: never executed: case r_duplicating_input_word: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1427 | case executed 49 times by 1 test: r_close_this:case r_close_this: Executed by:
executed 49 times by 1 test: case r_close_this: Executed by:
| 49 | ||||||||||||||||||||||||||||||||||||||||||||||||
1428 | return executed 49 times by 1 test: (redirector == 0);return (redirector == 0); Executed by:
executed 49 times by 1 test: return (redirector == 0); Executed by:
| 49 | ||||||||||||||||||||||||||||||||||||||||||||||||
1429 | case executed 23 times by 1 test: r_output_direction:case r_output_direction: Executed by:
executed 23 times by 1 test: case r_output_direction: Executed by:
| 23 | ||||||||||||||||||||||||||||||||||||||||||||||||
1430 | case executed 5 times by 1 test: r_appending_to:case r_appending_to: Executed by:
executed 5 times by 1 test: case r_appending_to: Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||
1431 | case executed 6 times by 1 test: r_duplicating_output:case r_duplicating_output: Executed by:
executed 6 times by 1 test: case r_duplicating_output: Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
1432 | case never executed: r_err_and_out:case r_err_and_out: never executed: case r_err_and_out: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1433 | case never executed: r_append_err_and_out:case r_append_err_and_out: never executed: case r_append_err_and_out: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1434 | case never executed: r_output_force:case r_output_force: never executed: case r_output_force: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1435 | case never executed: r_duplicating_output_word:case r_duplicating_output_word: never executed: case r_duplicating_output_word: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1436 | return executed 34 times by 1 test: (0);return (0); Executed by:
executed 34 times by 1 test: return (0); Executed by:
| 34 | ||||||||||||||||||||||||||||||||||||||||||||||||
1437 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1438 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1439 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1440 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1441 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1442 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1443 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1444 | stdin_redirects (redirs) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1445 | REDIRECT *redirs; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1446 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1447 | REDIRECT *rp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1448 | int n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1449 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1450 | for (n = 0, rp = redirs; rp
| 662101-663102 | ||||||||||||||||||||||||||||||||||||||||||||||||
1451 | if ((
| 1-662100 | ||||||||||||||||||||||||||||||||||||||||||||||||
1452 | n += stdin_redirection (rp->instruction, rp->redirector.dest); executed 662100 times by 1 test: n += stdin_redirection (rp->instruction, rp->redirector.dest); Executed by:
| 662100 | ||||||||||||||||||||||||||||||||||||||||||||||||
1453 | return executed 663102 times by 1 test: n;return n; Executed by:
executed 663102 times by 1 test: return n; Executed by:
| 663102 | ||||||||||||||||||||||||||||||||||||||||||||||||
1454 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1455 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1456 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1457 | redir_varassign (redir, fd) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1458 | REDIRECT *redir; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1459 | int fd; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1460 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1461 | WORD_DESC *w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1462 | SHELL_VAR *v; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1463 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1464 | w = redir->redirector.filename; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1465 | v = bind_var_to_int (w->word, fd); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1466 | if (v == 0
| 0-18 | ||||||||||||||||||||||||||||||||||||||||||||||||
1467 | return executed 7 times by 1 test: -5;return -5; Executed by:
executed 7 times by 1 test: return -5; Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||||||||||||||
1468 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1469 | stupidly_hack_special_variables (w->word); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1470 | return executed 17 times by 1 test: 0;return 0; Executed by:
executed 17 times by 1 test: return 0; Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||||||||||||||
1471 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1472 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1473 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1474 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1475 | redir_varvalue (redir) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1476 | REDIRECT *redir; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1477 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1478 | SHELL_VAR *v; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1479 | char *val, *w; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1480 | intmax_t vmax; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1481 | int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1482 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1483 | char *sub; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1484 | int len, vr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1485 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1486 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1487 | w = redir->redirector.filename->word; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1488 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1490 | if (vr = valid_array_reference (w, 0)
| 0-5 | ||||||||||||||||||||||||||||||||||||||||||||||||
1491 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1492 | v = array_variable_part (w, 0, &sub, &len); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1493 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1494 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1495 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1496 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1497 | v = find_variable (w); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1498 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1499 | if (v == 0
| 1-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1500 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1501 | v = find_variable_last_nameref (w, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1502 | if (v
| 0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1503 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1504 | w = ((v)->value); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1505 | if (vr = valid_array_reference (w, 0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1506 | v = array_variable_part (w, 0, &sub, &len); never executed: v = array_variable_part (w, 0, &sub, &len); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1507 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1508 | v = find_variable (w); never executed: v = find_variable (w); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1509 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1510 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1511 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1512 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||
1513 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1514 | if (v == 0
| 0-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1515 | return executed 1 time by 1 test: -1;return -1; Executed by:
executed 1 time by 1 test: return -1; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
1516 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1517 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1518 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1520 | if (vr
| 0-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1521 | val = get_array_value (w, 0, (int *) never executed: val = get_array_value (w, 0, (int *) ((void *)0) , (arrayind_t *)0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1522 | ((void *)0) never executed: val = get_array_value (w, 0, (int *) ((void *)0) , (arrayind_t *)0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1523 | , (arrayind_t *)0); never executed: val = get_array_value (w, 0, (int *) ((void *)0) , (arrayind_t *)0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1524 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1525 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1526 | val = get_variable_value (v); executed 4 times by 1 test: val = get_variable_value (v); Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1527 | if (val == 0
| 0-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1528 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1529 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1530 | if (legal_number (val, &vmax) < 0
| 0-4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1531 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1532 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1533 | i = vmax; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1534 | return executed 4 times by 1 test: i;return i; Executed by:
executed 4 times by 1 test: return i; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
1535 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |