Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/copy.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||
4 | struct dir_list | - | ||||||||||||||||||||||||||||||
5 | { | - | ||||||||||||||||||||||||||||||
6 | struct dir_list *parent; | - | ||||||||||||||||||||||||||||||
7 | ino_t ino; | - | ||||||||||||||||||||||||||||||
8 | dev_t dev; | - | ||||||||||||||||||||||||||||||
9 | }; | - | ||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||
14 | static | - | ||||||||||||||||||||||||||||||
15 | _Bool | - | ||||||||||||||||||||||||||||||
16 | copy_internal (char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||
18 | _Bool | - | ||||||||||||||||||||||||||||||
19 | new_dst, struct stat const *parent, | - | ||||||||||||||||||||||||||||||
20 | struct dir_list *ancestors, | - | ||||||||||||||||||||||||||||||
21 | const struct cp_options *x, | - | ||||||||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||||||||
23 | _Bool | - | ||||||||||||||||||||||||||||||
24 | command_line_arg, | - | ||||||||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||||||||
26 | _Bool | - | ||||||||||||||||||||||||||||||
27 | *first_dir_created_per_command_line_arg, | - | ||||||||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||||||||
29 | _Bool | - | ||||||||||||||||||||||||||||||
30 | *copy_into_self, | - | ||||||||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||||||||
32 | _Bool | - | ||||||||||||||||||||||||||||||
33 | *rename_succeeded); | - | ||||||||||||||||||||||||||||||
34 | static | - | ||||||||||||||||||||||||||||||
35 | _Bool | - | ||||||||||||||||||||||||||||||
36 | owner_failure_ok (struct cp_options const *x); | - | ||||||||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||||||||
38 | - | |||||||||||||||||||||||||||||||
39 | - | |||||||||||||||||||||||||||||||
40 | static char const *top_level_src_name; | - | ||||||||||||||||||||||||||||||
41 | static char const *top_level_dst_name; | - | ||||||||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||||||||
45 | static inline int | - | ||||||||||||||||||||||||||||||
46 | utimens_symlink (char const *file, struct timespec const *timespec) | - | ||||||||||||||||||||||||||||||
47 | { | - | ||||||||||||||||||||||||||||||
48 | int err = lutimens (file, timespec); | - | ||||||||||||||||||||||||||||||
49 | - | |||||||||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||
52 | if (err
| 0-3 | ||||||||||||||||||||||||||||||
53 | (*
| 0 | ||||||||||||||||||||||||||||||
54 | ==
| 0 | ||||||||||||||||||||||||||||||
55 | 38
| 0 | ||||||||||||||||||||||||||||||
56 | ) | - | ||||||||||||||||||||||||||||||
57 | err = 0; never executed: err = 0; | 0 | ||||||||||||||||||||||||||||||
58 | return executed 3 times by 2 tests: err;return err; Executed by:
executed 3 times by 2 tests: return err; Executed by:
| 3 | ||||||||||||||||||||||||||||||
59 | } | - | ||||||||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||||||||
65 | static int | - | ||||||||||||||||||||||||||||||
66 | punch_hole (int fd, off_t offset, off_t length) | - | ||||||||||||||||||||||||||||||
67 | { | - | ||||||||||||||||||||||||||||||
68 | int ret = 0; | - | ||||||||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||||||||
70 | - | |||||||||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||||||||
72 | ret = fallocate (fd, | - | ||||||||||||||||||||||||||||||
73 | 0x02 | - | ||||||||||||||||||||||||||||||
74 | | | - | ||||||||||||||||||||||||||||||
75 | 0x01 | - | ||||||||||||||||||||||||||||||
76 | , | - | ||||||||||||||||||||||||||||||
77 | offset, length); | - | ||||||||||||||||||||||||||||||
78 | if (ret < 0
| 0-1627 | ||||||||||||||||||||||||||||||
79 | (*__errno_location ())
| 0 | ||||||||||||||||||||||||||||||
80 | )
| 0 | ||||||||||||||||||||||||||||||
81 | (*
| 0 | ||||||||||||||||||||||||||||||
82 | ==
| 0 | ||||||||||||||||||||||||||||||
83 | 38
| 0 | ||||||||||||||||||||||||||||||
84 | )) | - | ||||||||||||||||||||||||||||||
85 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||||||||
88 | return executed 1627 times by 1 test: ret;return ret; Executed by:
executed 1627 times by 1 test: return ret; Executed by:
| 1627 | ||||||||||||||||||||||||||||||
89 | } | - | ||||||||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||||||||
94 | static | - | ||||||||||||||||||||||||||||||
95 | _Bool | - | ||||||||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||||||||
97 | create_hole (int fd, char const *name, | - | ||||||||||||||||||||||||||||||
98 | _Bool | - | ||||||||||||||||||||||||||||||
99 | punch_holes, off_t size) | - | ||||||||||||||||||||||||||||||
100 | { | - | ||||||||||||||||||||||||||||||
101 | off_t file_end = lseek (fd, size, | - | ||||||||||||||||||||||||||||||
102 | 1 | - | ||||||||||||||||||||||||||||||
103 | ); | - | ||||||||||||||||||||||||||||||
104 | - | |||||||||||||||||||||||||||||||
105 | if (file_end < 0
| 0-1619 | ||||||||||||||||||||||||||||||
106 | { | - | ||||||||||||||||||||||||||||||
107 | error (0, | - | ||||||||||||||||||||||||||||||
108 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
109 | , | - | ||||||||||||||||||||||||||||||
110 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
111 | "cannot lseek %s" | - | ||||||||||||||||||||||||||||||
112 | , 5) | - | ||||||||||||||||||||||||||||||
113 | , quotearg_style (shell_escape_always_quoting_style, name)); | - | ||||||||||||||||||||||||||||||
114 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
115 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
116 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
117 | } | - | ||||||||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||||||||
120 | - | |||||||||||||||||||||||||||||||
121 | - | |||||||||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||||||||
123 | if (punch_holes
| 0-1618 | ||||||||||||||||||||||||||||||
124 | { | - | ||||||||||||||||||||||||||||||
125 | error (0, | - | ||||||||||||||||||||||||||||||
126 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
127 | , | - | ||||||||||||||||||||||||||||||
128 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
129 | "error deallocating %s" | - | ||||||||||||||||||||||||||||||
130 | , 5) | - | ||||||||||||||||||||||||||||||
131 | , quotearg_style (shell_escape_always_quoting_style, name)); | - | ||||||||||||||||||||||||||||||
132 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
133 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
134 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
135 | } | - | ||||||||||||||||||||||||||||||
136 | - | |||||||||||||||||||||||||||||||
137 | return executed 1619 times by 1 test: return 1 ; Executed by:
executed 1619 times by 1 test: return 1 ; Executed by:
| 1619 | ||||||||||||||||||||||||||||||
138 | 1 executed 1619 times by 1 test: return 1 ; Executed by:
| 1619 | ||||||||||||||||||||||||||||||
139 | ; executed 1619 times by 1 test: return 1 ; Executed by:
| 1619 | ||||||||||||||||||||||||||||||
140 | } | - | ||||||||||||||||||||||||||||||
141 | static | - | ||||||||||||||||||||||||||||||
142 | _Bool | - | ||||||||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||||||||
144 | sparse_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, | - | ||||||||||||||||||||||||||||||
145 | size_t hole_size, | - | ||||||||||||||||||||||||||||||
146 | _Bool | - | ||||||||||||||||||||||||||||||
147 | punch_holes, | - | ||||||||||||||||||||||||||||||
148 | char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
149 | uintmax_t max_n_read, off_t *total_n_read, | - | ||||||||||||||||||||||||||||||
150 | - | |||||||||||||||||||||||||||||||
151 | _Bool | - | ||||||||||||||||||||||||||||||
152 | *last_write_made_hole) | - | ||||||||||||||||||||||||||||||
153 | { | - | ||||||||||||||||||||||||||||||
154 | *last_write_made_hole = | - | ||||||||||||||||||||||||||||||
155 | 0 | - | ||||||||||||||||||||||||||||||
156 | ; | - | ||||||||||||||||||||||||||||||
157 | *total_n_read = 0; | - | ||||||||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||||||||
159 | _Bool | - | ||||||||||||||||||||||||||||||
160 | make_hole = | - | ||||||||||||||||||||||||||||||
161 | 0 | - | ||||||||||||||||||||||||||||||
162 | ; | - | ||||||||||||||||||||||||||||||
163 | off_t psize = 0; | - | ||||||||||||||||||||||||||||||
164 | - | |||||||||||||||||||||||||||||||
165 | while (max_n_read
| 1394-7313 | ||||||||||||||||||||||||||||||
166 | { | - | ||||||||||||||||||||||||||||||
167 | ssize_t n_read = read (src_fd, buf, | - | ||||||||||||||||||||||||||||||
168 | ((( | - | ||||||||||||||||||||||||||||||
169 | max_n_read | - | ||||||||||||||||||||||||||||||
170 | )<( | - | ||||||||||||||||||||||||||||||
171 | buf_size | - | ||||||||||||||||||||||||||||||
172 | ))?( | - | ||||||||||||||||||||||||||||||
173 | max_n_read | - | ||||||||||||||||||||||||||||||
174 | ):( | - | ||||||||||||||||||||||||||||||
175 | buf_size | - | ||||||||||||||||||||||||||||||
176 | )) | - | ||||||||||||||||||||||||||||||
177 | ); | - | ||||||||||||||||||||||||||||||
178 | if (n_read < 0
| 0-7313 | ||||||||||||||||||||||||||||||
179 | { | - | ||||||||||||||||||||||||||||||
180 | if ( | - | ||||||||||||||||||||||||||||||
181 | (*
| 0 | ||||||||||||||||||||||||||||||
182 | ==
| 0 | ||||||||||||||||||||||||||||||
183 | 4
| 0 | ||||||||||||||||||||||||||||||
184 | ) | - | ||||||||||||||||||||||||||||||
185 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
186 | error (0, | - | ||||||||||||||||||||||||||||||
187 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
188 | , | - | ||||||||||||||||||||||||||||||
189 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
190 | "error reading %s" | - | ||||||||||||||||||||||||||||||
191 | , 5) | - | ||||||||||||||||||||||||||||||
192 | , quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
193 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
194 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
195 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
196 | } | - | ||||||||||||||||||||||||||||||
197 | if (n_read == 0
| 2918-4395 | ||||||||||||||||||||||||||||||
198 | break; executed 4395 times by 3 tests: break; Executed by:
| 4395 | ||||||||||||||||||||||||||||||
199 | max_n_read -= n_read; | - | ||||||||||||||||||||||||||||||
200 | *total_n_read += n_read; | - | ||||||||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||||||||
203 | size_t csize = hole_size
| 1444-1474 | ||||||||||||||||||||||||||||||
204 | char *cbuf = buf; | - | ||||||||||||||||||||||||||||||
205 | char *pbuf = buf; | - | ||||||||||||||||||||||||||||||
206 | - | |||||||||||||||||||||||||||||||
207 | while (n_read
| 2918-9418 | ||||||||||||||||||||||||||||||
208 | { | - | ||||||||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||||||||
210 | _Bool | - | ||||||||||||||||||||||||||||||
211 | prev_hole = make_hole; | - | ||||||||||||||||||||||||||||||
212 | csize = | - | ||||||||||||||||||||||||||||||
213 | (((
| 2918-6500 | ||||||||||||||||||||||||||||||
214 | csize
| 2918-6500 | ||||||||||||||||||||||||||||||
215 | )<(
| 2918-6500 | ||||||||||||||||||||||||||||||
216 | n_read
| 2918-6500 | ||||||||||||||||||||||||||||||
217 | ))
| 2918-6500 | ||||||||||||||||||||||||||||||
218 | csize | - | ||||||||||||||||||||||||||||||
219 | ):( | - | ||||||||||||||||||||||||||||||
220 | n_read | - | ||||||||||||||||||||||||||||||
221 | )) | - | ||||||||||||||||||||||||||||||
222 | ; | - | ||||||||||||||||||||||||||||||
223 | - | |||||||||||||||||||||||||||||||
224 | if (hole_size
| 4-7974 | ||||||||||||||||||||||||||||||
225 | make_hole = is_nul (cbuf, csize); executed 7970 times by 1 test: make_hole = is_nul (cbuf, csize); Executed by:
| 7970 | ||||||||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||||||||
228 | _Bool | - | ||||||||||||||||||||||||||||||
229 | transition = (
| 18-8942 | ||||||||||||||||||||||||||||||
230 | - | |||||||||||||||||||||||||||||||
231 | _Bool | - | ||||||||||||||||||||||||||||||
232 | last_chunk = (n_read == csize
| 4-6538 | ||||||||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||||||||
234 | if (transition
| 458-8960 | ||||||||||||||||||||||||||||||
235 | { | - | ||||||||||||||||||||||||||||||
236 | if (! transition
| 458-2876 | ||||||||||||||||||||||||||||||
237 | psize += csize; executed 2876 times by 3 tests: psize += csize; Executed by:
| 2876 | ||||||||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||||||||
239 | if (! prev_hole
| 234-3100 | ||||||||||||||||||||||||||||||
240 | { | - | ||||||||||||||||||||||||||||||
241 | if (full_write (dest_fd, pbuf, psize) != psize
| 0-3100 | ||||||||||||||||||||||||||||||
242 | { | - | ||||||||||||||||||||||||||||||
243 | error (0, | - | ||||||||||||||||||||||||||||||
244 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
245 | , | - | ||||||||||||||||||||||||||||||
246 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
247 | "error writing %s" | - | ||||||||||||||||||||||||||||||
248 | , 5) | - | ||||||||||||||||||||||||||||||
249 | , | - | ||||||||||||||||||||||||||||||
250 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
251 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
252 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
253 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
254 | } | - | ||||||||||||||||||||||||||||||
255 | } executed 3100 times by 3 tests: end of block Executed by:
| 3100 | ||||||||||||||||||||||||||||||
256 | else | - | ||||||||||||||||||||||||||||||
257 | { | - | ||||||||||||||||||||||||||||||
258 | if (! create_hole (dest_fd, dst_name, punch_holes, psize)
| 0-234 | ||||||||||||||||||||||||||||||
259 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
260 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
261 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
262 | } executed 234 times by 1 test: end of block Executed by:
| 234 | ||||||||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||||||||
264 | pbuf = cbuf; | - | ||||||||||||||||||||||||||||||
265 | psize = csize; | - | ||||||||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||||||||
267 | if (last_chunk
| 454-2880 | ||||||||||||||||||||||||||||||
268 | { | - | ||||||||||||||||||||||||||||||
269 | if (! csize
| 4-2876 | ||||||||||||||||||||||||||||||
270 | n_read = 0; executed 4 times by 1 test: n_read = 0; Executed by:
| 4 | ||||||||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||||||||
272 | if (transition
| 4-2876 | ||||||||||||||||||||||||||||||
273 | csize = 0; executed 4 times by 1 test: csize = 0; Executed by:
| 4 | ||||||||||||||||||||||||||||||
274 | else | - | ||||||||||||||||||||||||||||||
275 | psize = 0; executed 2876 times by 3 tests: psize = 0; Executed by:
| 2876 | ||||||||||||||||||||||||||||||
276 | } | - | ||||||||||||||||||||||||||||||
277 | } executed 3334 times by 3 tests: end of block Executed by:
| 3334 | ||||||||||||||||||||||||||||||
278 | else | - | ||||||||||||||||||||||||||||||
279 | { | - | ||||||||||||||||||||||||||||||
280 | if (psize <= ((off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))) - csize
| 0-6084 | ||||||||||||||||||||||||||||||
281 | psize += csize; executed 6084 times by 1 test: psize += csize; Executed by:
| 6084 | ||||||||||||||||||||||||||||||
282 | else | - | ||||||||||||||||||||||||||||||
283 | { | - | ||||||||||||||||||||||||||||||
284 | error (0, 0, | - | ||||||||||||||||||||||||||||||
285 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
286 | "overflow reading %s" | - | ||||||||||||||||||||||||||||||
287 | , 5) | - | ||||||||||||||||||||||||||||||
288 | , quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
289 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
290 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
291 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
292 | } | - | ||||||||||||||||||||||||||||||
293 | } | - | ||||||||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||||||||
295 | n_read -= csize; | - | ||||||||||||||||||||||||||||||
296 | cbuf += csize; | - | ||||||||||||||||||||||||||||||
297 | } executed 9418 times by 3 tests: end of block Executed by:
| 9418 | ||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||
299 | *last_write_made_hole = make_hole; | - | ||||||||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||||||||
301 | - | |||||||||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||||||||
305 | } executed 2918 times by 3 tests: end of block Executed by:
| 2918 | ||||||||||||||||||||||||||||||
306 | - | |||||||||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||||||||
308 | - | |||||||||||||||||||||||||||||||
309 | if (make_hole
| 0-5781 | ||||||||||||||||||||||||||||||
310 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
311 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
312 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
313 | else | - | ||||||||||||||||||||||||||||||
314 | return executed 5789 times by 3 tests: return 1 ; Executed by:
executed 5789 times by 3 tests: return 1 ; Executed by:
| 5789 | ||||||||||||||||||||||||||||||
315 | 1 executed 5789 times by 3 tests: return 1 ; Executed by:
| 5789 | ||||||||||||||||||||||||||||||
316 | ; executed 5789 times by 3 tests: return 1 ; Executed by:
| 5789 | ||||||||||||||||||||||||||||||
317 | } | - | ||||||||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||||||||
321 | static inline int | - | ||||||||||||||||||||||||||||||
322 | clone_file (int dest_fd, int src_fd) | - | ||||||||||||||||||||||||||||||
323 | { | - | ||||||||||||||||||||||||||||||
324 | - | |||||||||||||||||||||||||||||||
325 | return executed 3923 times by 2 tests: ioctl (dest_fd, return ioctl (dest_fd, (((1U) << (((0 +8)+8)+14)) | (((0x94)) << (0 +8)) | (((9)) << 0) | ((((sizeof(int)))) << ((0 +8)+8))) , src_fd); Executed by:
executed 3923 times by 2 tests: return ioctl (dest_fd, (((1U) << (((0 +8)+8)+14)) | (((0x94)) << (0 +8)) | (((9)) << 0) | ((((sizeof(int)))) << ((0 +8)+8))) , src_fd); Executed by:
| 3923 | ||||||||||||||||||||||||||||||
326 | (((1U) << (((0 +8)+8)+14)) | (((0x94)) << (0 +8)) | (((9)) << 0) | ((((sizeof(int)))) << ((0 +8)+8))) executed 3923 times by 2 tests: return ioctl (dest_fd, (((1U) << (((0 +8)+8)+14)) | (((0x94)) << (0 +8)) | (((9)) << 0) | ((((sizeof(int)))) << ((0 +8)+8))) , src_fd); Executed by:
| 3923 | ||||||||||||||||||||||||||||||
327 | , src_fd); executed 3923 times by 2 tests: return ioctl (dest_fd, (((1U) << (((0 +8)+8)+14)) | (((0x94)) << (0 +8)) | (((9)) << 0) | ((((sizeof(int)))) << ((0 +8)+8))) , src_fd); Executed by:
| 3923 | ||||||||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||||||||
329 | - | |||||||||||||||||||||||||||||||
330 | - | |||||||||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||||||||
332 | - | |||||||||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||||||||
334 | } | - | ||||||||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||||||||
336 | - | |||||||||||||||||||||||||||||||
337 | - | |||||||||||||||||||||||||||||||
338 | static | - | ||||||||||||||||||||||||||||||
339 | _Bool | - | ||||||||||||||||||||||||||||||
340 | - | |||||||||||||||||||||||||||||||
341 | write_zeros (int fd, off_t n_bytes) | - | ||||||||||||||||||||||||||||||
342 | { | - | ||||||||||||||||||||||||||||||
343 | static char *zeros; | - | ||||||||||||||||||||||||||||||
344 | static size_t nz = IO_BUFSIZE; | - | ||||||||||||||||||||||||||||||
345 | - | |||||||||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||||||||
349 | if (zeros ==
| 0-5 | ||||||||||||||||||||||||||||||
350 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||||||||
351 | ) | - | ||||||||||||||||||||||||||||||
352 | { | - | ||||||||||||||||||||||||||||||
353 | static char fallback[1024]; | - | ||||||||||||||||||||||||||||||
354 | zeros = calloc (nz, 1); | - | ||||||||||||||||||||||||||||||
355 | if (zeros ==
| 0-5 | ||||||||||||||||||||||||||||||
356 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||||||||
357 | ) | - | ||||||||||||||||||||||||||||||
358 | { | - | ||||||||||||||||||||||||||||||
359 | zeros = fallback; | - | ||||||||||||||||||||||||||||||
360 | nz = sizeof fallback; | - | ||||||||||||||||||||||||||||||
361 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
362 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||||||||
364 | while (n_bytes
| 5-42 | ||||||||||||||||||||||||||||||
365 | { | - | ||||||||||||||||||||||||||||||
366 | size_t n = | - | ||||||||||||||||||||||||||||||
367 | (((
| 5-37 | ||||||||||||||||||||||||||||||
368 | nz
| 5-37 | ||||||||||||||||||||||||||||||
369 | )<(
| 5-37 | ||||||||||||||||||||||||||||||
370 | n_bytes
| 5-37 | ||||||||||||||||||||||||||||||
371 | ))
| 5-37 | ||||||||||||||||||||||||||||||
372 | nz | - | ||||||||||||||||||||||||||||||
373 | ):( | - | ||||||||||||||||||||||||||||||
374 | n_bytes | - | ||||||||||||||||||||||||||||||
375 | )) | - | ||||||||||||||||||||||||||||||
376 | ; | - | ||||||||||||||||||||||||||||||
377 | if ((
| 0-42 | ||||||||||||||||||||||||||||||
378 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
379 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
380 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
381 | n_bytes -= n; | - | ||||||||||||||||||||||||||||||
382 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||||||||
384 | return executed 5 times by 1 test: return 1 ; Executed by:
executed 5 times by 1 test: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
385 | 1 executed 5 times by 1 test: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
386 | ; executed 5 times by 1 test: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
387 | } | - | ||||||||||||||||||||||||||||||
388 | static | - | ||||||||||||||||||||||||||||||
389 | _Bool | - | ||||||||||||||||||||||||||||||
390 | - | |||||||||||||||||||||||||||||||
391 | extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, | - | ||||||||||||||||||||||||||||||
392 | size_t hole_size, off_t src_total_size, | - | ||||||||||||||||||||||||||||||
393 | enum Sparse_type sparse_mode, | - | ||||||||||||||||||||||||||||||
394 | char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||||||||
396 | _Bool | - | ||||||||||||||||||||||||||||||
397 | *require_normal_copy) | - | ||||||||||||||||||||||||||||||
398 | { | - | ||||||||||||||||||||||||||||||
399 | struct extent_scan scan; | - | ||||||||||||||||||||||||||||||
400 | off_t last_ext_start = 0; | - | ||||||||||||||||||||||||||||||
401 | off_t last_ext_len = 0; | - | ||||||||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||||||||
405 | off_t dest_pos = 0; | - | ||||||||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||||||||
407 | extent_scan_init (src_fd, &scan); | - | ||||||||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||||||||
409 | *require_normal_copy = | - | ||||||||||||||||||||||||||||||
410 | 0 | - | ||||||||||||||||||||||||||||||
411 | ; | - | ||||||||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||||||||
413 | _Bool | - | ||||||||||||||||||||||||||||||
414 | wrote_hole_at_eof = | - | ||||||||||||||||||||||||||||||
415 | 1 | - | ||||||||||||||||||||||||||||||
416 | ; | - | ||||||||||||||||||||||||||||||
417 | do | - | ||||||||||||||||||||||||||||||
418 | { | - | ||||||||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||||||||
420 | _Bool | - | ||||||||||||||||||||||||||||||
421 | ok = extent_scan_read (&scan); | - | ||||||||||||||||||||||||||||||
422 | if (! ok
| 9-64 | ||||||||||||||||||||||||||||||
423 | { | - | ||||||||||||||||||||||||||||||
424 | if (scan.hit_final_extent
| 4-5 | ||||||||||||||||||||||||||||||
425 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||||||||
427 | if (scan.initial_scan_failed
| 0-5 | ||||||||||||||||||||||||||||||
428 | { | - | ||||||||||||||||||||||||||||||
429 | *require_normal_copy = | - | ||||||||||||||||||||||||||||||
430 | 1 | - | ||||||||||||||||||||||||||||||
431 | ; | - | ||||||||||||||||||||||||||||||
432 | return executed 5 times by 1 test: return 0 ; Executed by:
executed 5 times by 1 test: return 0 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
433 | 0 executed 5 times by 1 test: return 0 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
434 | ; executed 5 times by 1 test: return 0 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
435 | } | - | ||||||||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||||||||
437 | error (0, | - | ||||||||||||||||||||||||||||||
438 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
439 | , | - | ||||||||||||||||||||||||||||||
440 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
441 | "%s: failed to get extents info" | - | ||||||||||||||||||||||||||||||
442 | , 5) | - | ||||||||||||||||||||||||||||||
443 | , | - | ||||||||||||||||||||||||||||||
444 | quotearg_n_style_colon (0, shell_escape_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
445 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
446 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
447 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
448 | } | - | ||||||||||||||||||||||||||||||
449 | - | |||||||||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||||||||
451 | _Bool | - | ||||||||||||||||||||||||||||||
452 | empty_extent = | - | ||||||||||||||||||||||||||||||
453 | 0 | - | ||||||||||||||||||||||||||||||
454 | ; | - | ||||||||||||||||||||||||||||||
455 | for (unsigned int i = 0; i < scan.ei_count
| 0-1394 | ||||||||||||||||||||||||||||||
456 | { | - | ||||||||||||||||||||||||||||||
457 | off_t ext_start; | - | ||||||||||||||||||||||||||||||
458 | off_t ext_len; | - | ||||||||||||||||||||||||||||||
459 | off_t ext_hole_size; | - | ||||||||||||||||||||||||||||||
460 | - | |||||||||||||||||||||||||||||||
461 | if (i < scan.ei_count
| 0-1394 | ||||||||||||||||||||||||||||||
462 | { | - | ||||||||||||||||||||||||||||||
463 | ext_start = scan.ext_info[i].ext_logical; | - | ||||||||||||||||||||||||||||||
464 | ext_len = scan.ext_info[i].ext_length; | - | ||||||||||||||||||||||||||||||
465 | } executed 1394 times by 1 test: end of block Executed by:
| 1394 | ||||||||||||||||||||||||||||||
466 | else | - | ||||||||||||||||||||||||||||||
467 | { | - | ||||||||||||||||||||||||||||||
468 | i--; | - | ||||||||||||||||||||||||||||||
469 | ext_start = last_ext_start + scan.ext_info[i].ext_length; | - | ||||||||||||||||||||||||||||||
470 | ext_len = 0; | - | ||||||||||||||||||||||||||||||
471 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
472 | if (src_total_size < ext_start + ext_len
| 23-1371 | ||||||||||||||||||||||||||||||
473 | { | - | ||||||||||||||||||||||||||||||
474 | if (src_total_size < ext_start
| 3-20 | ||||||||||||||||||||||||||||||
475 | ext_start = src_total_size; executed 3 times by 1 test: ext_start = src_total_size; Executed by:
| 3 | ||||||||||||||||||||||||||||||
476 | ext_len = src_total_size - ext_start; | - | ||||||||||||||||||||||||||||||
477 | } executed 23 times by 1 test: end of block Executed by:
| 23 | ||||||||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||||||||
479 | ext_hole_size = ext_start - last_ext_start - last_ext_len; | - | ||||||||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||||||||
481 | wrote_hole_at_eof = | - | ||||||||||||||||||||||||||||||
482 | 0 | - | ||||||||||||||||||||||||||||||
483 | ; | - | ||||||||||||||||||||||||||||||
484 | - | |||||||||||||||||||||||||||||||
485 | if (ext_hole_size
| 15-1379 | ||||||||||||||||||||||||||||||
486 | { | - | ||||||||||||||||||||||||||||||
487 | if (lseek (src_fd, ext_start,
| 0-1379 | ||||||||||||||||||||||||||||||
488 | 0
| 0-1379 | ||||||||||||||||||||||||||||||
489 | ) < 0
| 0-1379 | ||||||||||||||||||||||||||||||
490 | { | - | ||||||||||||||||||||||||||||||
491 | error (0, | - | ||||||||||||||||||||||||||||||
492 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
493 | , | - | ||||||||||||||||||||||||||||||
494 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
495 | "cannot lseek %s" | - | ||||||||||||||||||||||||||||||
496 | , 5) | - | ||||||||||||||||||||||||||||||
497 | , quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
498 | fail: code before this statement never executed: fail: | 0 | ||||||||||||||||||||||||||||||
499 | extent_scan_free (&scan); | - | ||||||||||||||||||||||||||||||
500 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
501 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
502 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
503 | } | - | ||||||||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||||||||
505 | if ((empty_extent
| 0-1379 | ||||||||||||||||||||||||||||||
506 | || (!empty_extent
| 0-1379 | ||||||||||||||||||||||||||||||
507 | { | - | ||||||||||||||||||||||||||||||
508 | if (! create_hole (dest_fd, dst_name,
| 0-1377 | ||||||||||||||||||||||||||||||
509 | sparse_mode == SPARSE_ALWAYS,
| 0-1377 | ||||||||||||||||||||||||||||||
510 | ext_hole_size)
| 0-1377 | ||||||||||||||||||||||||||||||
511 | goto never executed: fail;goto fail; never executed: goto fail; | 0 | ||||||||||||||||||||||||||||||
512 | wrote_hole_at_eof = | - | ||||||||||||||||||||||||||||||
513 | 1 | - | ||||||||||||||||||||||||||||||
514 | ; | - | ||||||||||||||||||||||||||||||
515 | } executed 1377 times by 1 test: end of block Executed by:
| 1377 | ||||||||||||||||||||||||||||||
516 | else | - | ||||||||||||||||||||||||||||||
517 | { | - | ||||||||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||||||||
521 | off_t nzeros = ext_hole_size; | - | ||||||||||||||||||||||||||||||
522 | if (empty_extent
| 0-2 | ||||||||||||||||||||||||||||||
523 | nzeros = never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
524 | (((
never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
525 | src_total_size - dest_pos
never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
526 | )<(
never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
527 | ext_hole_size
never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
528 | ))
never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
529 | src_total_size - dest_pos never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
530 | ):( never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
531 | ext_hole_size never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
532 | )) never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
533 | ; never executed: nzeros = ((( src_total_size - dest_pos )<( ext_hole_size ))?( src_total_size - dest_pos ):( ext_hole_size )) ; | 0 | ||||||||||||||||||||||||||||||
534 | - | |||||||||||||||||||||||||||||||
535 | if (! write_zeros (dest_fd, nzeros)
| 0-2 | ||||||||||||||||||||||||||||||
536 | { | - | ||||||||||||||||||||||||||||||
537 | error (0, | - | ||||||||||||||||||||||||||||||
538 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
539 | , | - | ||||||||||||||||||||||||||||||
540 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
541 | "%s: write failed" | - | ||||||||||||||||||||||||||||||
542 | , 5) | - | ||||||||||||||||||||||||||||||
543 | , | - | ||||||||||||||||||||||||||||||
544 | quotearg_n_style_colon (0, shell_escape_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
545 | goto never executed: fail;goto fail; never executed: goto fail; | 0 | ||||||||||||||||||||||||||||||
546 | } | - | ||||||||||||||||||||||||||||||
547 | - | |||||||||||||||||||||||||||||||
548 | dest_pos = | - | ||||||||||||||||||||||||||||||
549 | (((
| 0-2 | ||||||||||||||||||||||||||||||
550 | src_total_size
| 0-2 | ||||||||||||||||||||||||||||||
551 | )<(
| 0-2 | ||||||||||||||||||||||||||||||
552 | ext_start
| 0-2 | ||||||||||||||||||||||||||||||
553 | ))
| 0-2 | ||||||||||||||||||||||||||||||
554 | src_total_size | - | ||||||||||||||||||||||||||||||
555 | ):( | - | ||||||||||||||||||||||||||||||
556 | ext_start | - | ||||||||||||||||||||||||||||||
557 | )) | - | ||||||||||||||||||||||||||||||
558 | ; | - | ||||||||||||||||||||||||||||||
559 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
560 | } | - | ||||||||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||||||||
562 | last_ext_start = ext_start; | - | ||||||||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||||||||
565 | - | |||||||||||||||||||||||||||||||
566 | - | |||||||||||||||||||||||||||||||
567 | - | |||||||||||||||||||||||||||||||
568 | - | |||||||||||||||||||||||||||||||
569 | - | |||||||||||||||||||||||||||||||
570 | if (0 && ( dead code: scan.ext_info[i].ext_flags & 0x00000800)(scan.ext_info[i].ext_flags & 0x00000800) dead code: )(scan.ext_info[i].ext_flags & 0x00000800) | - | ||||||||||||||||||||||||||||||
571 | { dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
572 | empty_extent = dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
573 | 1 dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
574 | ; dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
575 | last_ext_len = 0; dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
576 | if (ext_len == 0) dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
577 | empty_extent = dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
578 | 0 dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
579 | ; dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
580 | } dead code: { empty_extent = 1 ; last_ext_len = 0; if (ext_len == 0) empty_extent = 0 ; } | - | ||||||||||||||||||||||||||||||
581 | else | - | ||||||||||||||||||||||||||||||
582 | { | - | ||||||||||||||||||||||||||||||
583 | off_t n_read; | - | ||||||||||||||||||||||||||||||
584 | empty_extent = | - | ||||||||||||||||||||||||||||||
585 | 0 | - | ||||||||||||||||||||||||||||||
586 | ; | - | ||||||||||||||||||||||||||||||
587 | last_ext_len = ext_len; | - | ||||||||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||||||||
589 | _Bool | - | ||||||||||||||||||||||||||||||
590 | read_hole; | - | ||||||||||||||||||||||||||||||
591 | - | |||||||||||||||||||||||||||||||
592 | if ( ! sparse_copy (src_fd, dest_fd, buf, buf_size,
| 0-1394 | ||||||||||||||||||||||||||||||
593 | sparse_mode == SPARSE_ALWAYS ? hole_size: 0,
| 0-1394 | ||||||||||||||||||||||||||||||
594 |
| 0-1394 | ||||||||||||||||||||||||||||||
595 | 1
| 0-1394 | ||||||||||||||||||||||||||||||
596 | , src_name, dst_name, ext_len, &n_read,
| 0-1394 | ||||||||||||||||||||||||||||||
597 | &read_hole)
| 0-1394 | ||||||||||||||||||||||||||||||
598 | goto never executed: fail;goto fail; never executed: goto fail; | 0 | ||||||||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||||||||
600 | dest_pos = ext_start + n_read; | - | ||||||||||||||||||||||||||||||
601 | if (n_read
| 3-1391 | ||||||||||||||||||||||||||||||
602 | wrote_hole_at_eof = read_hole; executed 1391 times by 1 test: wrote_hole_at_eof = read_hole; Executed by:
| 1391 | ||||||||||||||||||||||||||||||
603 | } executed 1394 times by 1 test: end of block Executed by:
| 1394 | ||||||||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||||||||
607 | - | |||||||||||||||||||||||||||||||
608 | - | |||||||||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||||||||
610 | if (dest_pos == src_total_size
| 46-1348 | ||||||||||||||||||||||||||||||
611 | { | - | ||||||||||||||||||||||||||||||
612 | scan.hit_final_extent = | - | ||||||||||||||||||||||||||||||
613 | 1 | - | ||||||||||||||||||||||||||||||
614 | ; | - | ||||||||||||||||||||||||||||||
615 | break; executed 46 times by 1 test: break; Executed by:
| 46 | ||||||||||||||||||||||||||||||
616 | } | - | ||||||||||||||||||||||||||||||
617 | } executed 1348 times by 1 test: end of block Executed by:
| 1348 | ||||||||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||||||||
620 | extent_scan_free (&scan); | - | ||||||||||||||||||||||||||||||
621 | - | |||||||||||||||||||||||||||||||
622 | } executed 64 times by 1 test: end of block Executed by:
| 64 | ||||||||||||||||||||||||||||||
623 | while (! scan.hit_final_extent
| 8-56 | ||||||||||||||||||||||||||||||
624 | if ((dest_pos < src_total_size
| 2-46 | ||||||||||||||||||||||||||||||
625 | && (
| 0-16 | ||||||||||||||||||||||||||||||
626 | ? ftruncate (dest_fd, src_total_size)
| 0-16 | ||||||||||||||||||||||||||||||
627 | : ! write_zeros (dest_fd, src_total_size - dest_pos))
| 0-16 | ||||||||||||||||||||||||||||||
628 | { | - | ||||||||||||||||||||||||||||||
629 | error (0, | - | ||||||||||||||||||||||||||||||
630 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
631 | , | - | ||||||||||||||||||||||||||||||
632 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
633 | "failed to extend %s" | - | ||||||||||||||||||||||||||||||
634 | , 5) | - | ||||||||||||||||||||||||||||||
635 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
636 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
637 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
638 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
639 | } | - | ||||||||||||||||||||||||||||||
640 | - | |||||||||||||||||||||||||||||||
641 | if (sparse_mode == SPARSE_ALWAYS
| 8-52 | ||||||||||||||||||||||||||||||
642 | && punch_hole (dest_fd, dest_pos, src_total_size - dest_pos) < 0
| 0-9 | ||||||||||||||||||||||||||||||
643 | { | - | ||||||||||||||||||||||||||||||
644 | error (0, | - | ||||||||||||||||||||||||||||||
645 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
646 | , | - | ||||||||||||||||||||||||||||||
647 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
648 | "error deallocating %s" | - | ||||||||||||||||||||||||||||||
649 | , 5) | - | ||||||||||||||||||||||||||||||
650 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
651 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
652 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
653 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
654 | } | - | ||||||||||||||||||||||||||||||
655 | - | |||||||||||||||||||||||||||||||
656 | return executed 60 times by 1 test: return 1 ; Executed by:
executed 60 times by 1 test: return 1 ; Executed by:
| 60 | ||||||||||||||||||||||||||||||
657 | 1 executed 60 times by 1 test: return 1 ; Executed by:
| 60 | ||||||||||||||||||||||||||||||
658 | ; executed 60 times by 1 test: return 1 ; Executed by:
| 60 | ||||||||||||||||||||||||||||||
659 | } | - | ||||||||||||||||||||||||||||||
660 | - | |||||||||||||||||||||||||||||||
661 | - | |||||||||||||||||||||||||||||||
662 | - | |||||||||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||||||||
664 | - | |||||||||||||||||||||||||||||||
665 | - | |||||||||||||||||||||||||||||||
666 | static | - | ||||||||||||||||||||||||||||||
667 | _Bool | - | ||||||||||||||||||||||||||||||
668 | __attribute__ ((__pure__)) | - | ||||||||||||||||||||||||||||||
669 | is_ancestor (const struct stat *sb, const struct dir_list *ancestors) | - | ||||||||||||||||||||||||||||||
670 | { | - | ||||||||||||||||||||||||||||||
671 | while (ancestors != 0
| 33971-50028 | ||||||||||||||||||||||||||||||
672 | { | - | ||||||||||||||||||||||||||||||
673 | if (ancestors->ino == sb->st_ino
| 0-50028 | ||||||||||||||||||||||||||||||
674 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
675 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
676 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
677 | ancestors = ancestors->parent; | - | ||||||||||||||||||||||||||||||
678 | } executed 50028 times by 2 tests: end of block Executed by:
| 50028 | ||||||||||||||||||||||||||||||
679 | return executed 33971 times by 2 tests: return 0 ; Executed by:
executed 33971 times by 2 tests: return 0 ; Executed by:
| 33971 | ||||||||||||||||||||||||||||||
680 | 0 executed 33971 times by 2 tests: return 0 ; Executed by:
| 33971 | ||||||||||||||||||||||||||||||
681 | ; executed 33971 times by 2 tests: return 0 ; Executed by:
| 33971 | ||||||||||||||||||||||||||||||
682 | } | - | ||||||||||||||||||||||||||||||
683 | - | |||||||||||||||||||||||||||||||
684 | static | - | ||||||||||||||||||||||||||||||
685 | _Bool | - | ||||||||||||||||||||||||||||||
686 | - | |||||||||||||||||||||||||||||||
687 | errno_unsupported (int err) | - | ||||||||||||||||||||||||||||||
688 | { | - | ||||||||||||||||||||||||||||||
689 | return never executed: err == return err == 95 || err == 61 ; never executed: return err == 95 || err == 61 ; | 0 | ||||||||||||||||||||||||||||||
690 | 95 never executed: return err == 95 || err == 61 ; | 0 | ||||||||||||||||||||||||||||||
691 | || err == never executed: return err == 95 || err == 61 ; | 0 | ||||||||||||||||||||||||||||||
692 | 61 never executed: return err == 95 || err == 61 ; | 0 | ||||||||||||||||||||||||||||||
693 | ; never executed: return err == 95 || err == 61 ; | 0 | ||||||||||||||||||||||||||||||
694 | } | - | ||||||||||||||||||||||||||||||
695 | static | - | ||||||||||||||||||||||||||||||
696 | _Bool | - | ||||||||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||||||||
698 | copy_attr (char const *src_path __attribute__ ((__unused__)), | - | ||||||||||||||||||||||||||||||
699 | int src_fd __attribute__ ((__unused__)), | - | ||||||||||||||||||||||||||||||
700 | char const *dst_path __attribute__ ((__unused__)), | - | ||||||||||||||||||||||||||||||
701 | int dst_fd __attribute__ ((__unused__)), | - | ||||||||||||||||||||||||||||||
702 | struct cp_options const *x __attribute__ ((__unused__))) | - | ||||||||||||||||||||||||||||||
703 | { | - | ||||||||||||||||||||||||||||||
704 | return executed 37858 times by 2 tests: return 1 ; Executed by:
executed 37858 times by 2 tests: return 1 ; Executed by:
| 37858 | ||||||||||||||||||||||||||||||
705 | 1 executed 37858 times by 2 tests: return 1 ; Executed by:
| 37858 | ||||||||||||||||||||||||||||||
706 | ; executed 37858 times by 2 tests: return 1 ; Executed by:
| 37858 | ||||||||||||||||||||||||||||||
707 | } | - | ||||||||||||||||||||||||||||||
708 | static | - | ||||||||||||||||||||||||||||||
709 | _Bool | - | ||||||||||||||||||||||||||||||
710 | - | |||||||||||||||||||||||||||||||
711 | copy_dir (char const *src_name_in, char const *dst_name_in, | - | ||||||||||||||||||||||||||||||
712 | _Bool | - | ||||||||||||||||||||||||||||||
713 | new_dst, | - | ||||||||||||||||||||||||||||||
714 | const struct stat *src_sb, struct dir_list *ancestors, | - | ||||||||||||||||||||||||||||||
715 | const struct cp_options *x, | - | ||||||||||||||||||||||||||||||
716 | - | |||||||||||||||||||||||||||||||
717 | _Bool | - | ||||||||||||||||||||||||||||||
718 | *first_dir_created_per_command_line_arg, | - | ||||||||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||||||||
720 | _Bool | - | ||||||||||||||||||||||||||||||
721 | *copy_into_self) | - | ||||||||||||||||||||||||||||||
722 | { | - | ||||||||||||||||||||||||||||||
723 | char *name_space; | - | ||||||||||||||||||||||||||||||
724 | char *namep; | - | ||||||||||||||||||||||||||||||
725 | struct cp_options non_command_line_options = *x; | - | ||||||||||||||||||||||||||||||
726 | - | |||||||||||||||||||||||||||||||
727 | _Bool | - | ||||||||||||||||||||||||||||||
728 | ok = | - | ||||||||||||||||||||||||||||||
729 | 1 | - | ||||||||||||||||||||||||||||||
730 | ; | - | ||||||||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||||||||
732 | name_space = savedir (src_name_in, SAVEDIR_SORT_FASTREAD); | - | ||||||||||||||||||||||||||||||
733 | if (name_space ==
| 0-33971 | ||||||||||||||||||||||||||||||
734 | ((void *)0)
| 0-33971 | ||||||||||||||||||||||||||||||
735 | ) | - | ||||||||||||||||||||||||||||||
736 | { | - | ||||||||||||||||||||||||||||||
737 | - | |||||||||||||||||||||||||||||||
738 | - | |||||||||||||||||||||||||||||||
739 | error (0, | - | ||||||||||||||||||||||||||||||
740 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
741 | , | - | ||||||||||||||||||||||||||||||
742 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
743 | "cannot access %s" | - | ||||||||||||||||||||||||||||||
744 | , 5) | - | ||||||||||||||||||||||||||||||
745 | , quotearg_style (shell_escape_always_quoting_style, src_name_in)); | - | ||||||||||||||||||||||||||||||
746 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
747 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
748 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
749 | } | - | ||||||||||||||||||||||||||||||
750 | - | |||||||||||||||||||||||||||||||
751 | - | |||||||||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||||||||
753 | if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS
| 2-33969 | ||||||||||||||||||||||||||||||
754 | non_command_line_options.dereference = DEREF_NEVER; executed 2 times by 1 test: non_command_line_options.dereference = DEREF_NEVER; Executed by:
| 2 | ||||||||||||||||||||||||||||||
755 | - | |||||||||||||||||||||||||||||||
756 | - | |||||||||||||||||||||||||||||||
757 | _Bool | - | ||||||||||||||||||||||||||||||
758 | new_first_dir_created = | - | ||||||||||||||||||||||||||||||
759 | 0 | - | ||||||||||||||||||||||||||||||
760 | ; | - | ||||||||||||||||||||||||||||||
761 | namep = name_space; | - | ||||||||||||||||||||||||||||||
762 | while (*
| 33960-63958 | ||||||||||||||||||||||||||||||
763 | { | - | ||||||||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||||||||
765 | _Bool | - | ||||||||||||||||||||||||||||||
766 | local_copy_into_self; | - | ||||||||||||||||||||||||||||||
767 | char *src_name = file_name_concat (src_name_in, namep, | - | ||||||||||||||||||||||||||||||
768 | ((void *)0) | - | ||||||||||||||||||||||||||||||
769 | ); | - | ||||||||||||||||||||||||||||||
770 | char *dst_name = file_name_concat (dst_name_in, namep, | - | ||||||||||||||||||||||||||||||
771 | ((void *)0) | - | ||||||||||||||||||||||||||||||
772 | ); | - | ||||||||||||||||||||||||||||||
773 | - | |||||||||||||||||||||||||||||||
774 | _Bool | - | ||||||||||||||||||||||||||||||
775 | first_dir_created = *first_dir_created_per_command_line_arg; | - | ||||||||||||||||||||||||||||||
776 | - | |||||||||||||||||||||||||||||||
777 | ok &= copy_internal (src_name, dst_name, new_dst, src_sb, | - | ||||||||||||||||||||||||||||||
778 | ancestors, &non_command_line_options, | - | ||||||||||||||||||||||||||||||
779 | 0 | - | ||||||||||||||||||||||||||||||
780 | , | - | ||||||||||||||||||||||||||||||
781 | &first_dir_created, | - | ||||||||||||||||||||||||||||||
782 | &local_copy_into_self, | - | ||||||||||||||||||||||||||||||
783 | ((void *)0) | - | ||||||||||||||||||||||||||||||
784 | ); | - | ||||||||||||||||||||||||||||||
785 | *copy_into_self |= local_copy_into_self; | - | ||||||||||||||||||||||||||||||
786 | - | |||||||||||||||||||||||||||||||
787 | free (dst_name); | - | ||||||||||||||||||||||||||||||
788 | free (src_name); | - | ||||||||||||||||||||||||||||||
789 | - | |||||||||||||||||||||||||||||||
790 | - | |||||||||||||||||||||||||||||||
791 | - | |||||||||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||||||||
793 | if (local_copy_into_self
| 11-63947 | ||||||||||||||||||||||||||||||
794 | break; executed 11 times by 1 test: break; Executed by:
| 11 | ||||||||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||||||||
796 | new_first_dir_created |= first_dir_created; | - | ||||||||||||||||||||||||||||||
797 | namep += strlen (namep) + 1; | - | ||||||||||||||||||||||||||||||
798 | } executed 63947 times by 2 tests: end of block Executed by:
| 63947 | ||||||||||||||||||||||||||||||
799 | free (name_space); | - | ||||||||||||||||||||||||||||||
800 | *first_dir_created_per_command_line_arg = new_first_dir_created; | - | ||||||||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||||||||
802 | return executed 33971 times by 2 tests: ok;return ok; Executed by:
executed 33971 times by 2 tests: return ok; Executed by:
| 33971 | ||||||||||||||||||||||||||||||
803 | } | - | ||||||||||||||||||||||||||||||
804 | static int | - | ||||||||||||||||||||||||||||||
805 | set_owner (const struct cp_options *x, char const *dst_name, int dest_desc, | - | ||||||||||||||||||||||||||||||
806 | struct stat const *src_sb, | - | ||||||||||||||||||||||||||||||
807 | _Bool | - | ||||||||||||||||||||||||||||||
808 | new_dst, | - | ||||||||||||||||||||||||||||||
809 | struct stat const *dst_sb) | - | ||||||||||||||||||||||||||||||
810 | { | - | ||||||||||||||||||||||||||||||
811 | uid_t uid = src_sb->st_uid; | - | ||||||||||||||||||||||||||||||
812 | gid_t gid = src_sb->st_gid; | - | ||||||||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||||||||
814 | - | |||||||||||||||||||||||||||||||
815 | - | |||||||||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||||||||
817 | - | |||||||||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||||||||
820 | if (!new_dst
| 0-33933 | ||||||||||||||||||||||||||||||
821 | { | - | ||||||||||||||||||||||||||||||
822 | mode_t old_mode = dst_sb->st_mode; | - | ||||||||||||||||||||||||||||||
823 | mode_t new_mode = | - | ||||||||||||||||||||||||||||||
824 | (x->preserve_mode
| 0-1 | ||||||||||||||||||||||||||||||
825 | mode_t restrictive_temp_mode = old_mode & new_mode & | - | ||||||||||||||||||||||||||||||
826 | (0400|0200|0100) | - | ||||||||||||||||||||||||||||||
827 | ; | - | ||||||||||||||||||||||||||||||
828 | - | |||||||||||||||||||||||||||||||
829 | if ((0 | - | ||||||||||||||||||||||||||||||
830 | || (
| 0-1 | ||||||||||||||||||||||||||||||
831 | 04000
| 0-1 | ||||||||||||||||||||||||||||||
832 | |
| 0-1 | ||||||||||||||||||||||||||||||
833 | 02000
| 0-1 | ||||||||||||||||||||||||||||||
834 | |
| 0-1 | ||||||||||||||||||||||||||||||
835 | 01000
| 0-1 | ||||||||||||||||||||||||||||||
836 | |
| 0-1 | ||||||||||||||||||||||||||||||
837 | (0400|0200|0100)
| 0-1 | ||||||||||||||||||||||||||||||
838 | |
| 0-1 | ||||||||||||||||||||||||||||||
839 | ((0400|0200|0100) >> 3)
| 0-1 | ||||||||||||||||||||||||||||||
840 | |
| 0-1 | ||||||||||||||||||||||||||||||
841 | (((0400|0200|0100) >> 3) >> 3)
| 0-1 | ||||||||||||||||||||||||||||||
842 | )
| 0-1 | ||||||||||||||||||||||||||||||
843 | & (~new_mode |
| 0-1 | ||||||||||||||||||||||||||||||
844 | 04000
| 0-1 | ||||||||||||||||||||||||||||||
845 | |
| 0-1 | ||||||||||||||||||||||||||||||
846 | 02000
| 0-1 | ||||||||||||||||||||||||||||||
847 | |
| 0-1 | ||||||||||||||||||||||||||||||
848 | 01000
| 0-1 | ||||||||||||||||||||||||||||||
849 | ))
| 0-1 | ||||||||||||||||||||||||||||||
850 | && qset_acl (dst_name, dest_desc, restrictive_temp_mode) != 0
| 0-1 | ||||||||||||||||||||||||||||||
851 | { | - | ||||||||||||||||||||||||||||||
852 | if (! owner_failure_ok (x)
| 0 | ||||||||||||||||||||||||||||||
853 | error (0, never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
854 | (*__errno_location ()) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
855 | , never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
856 | dcgettext (((void *)0), never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
857 | "clearing permissions for %s" never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
858 | , 5) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
859 | , never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
860 | quotearg_style (shell_escape_always_quoting_style, dst_name)); never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "clearing permissions for %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
861 | return never executed: -x->require_preserve;return -x->require_preserve; never executed: return -x->require_preserve; | 0 | ||||||||||||||||||||||||||||||
862 | } | - | ||||||||||||||||||||||||||||||
863 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
864 | - | |||||||||||||||||||||||||||||||
865 | if (1 && dest_desc != -1
| 1-33933 | ||||||||||||||||||||||||||||||
866 | { | - | ||||||||||||||||||||||||||||||
867 | if (fchown (dest_desc, uid, gid) == 0
| 0-1 | ||||||||||||||||||||||||||||||
868 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||||||||||||||
869 | if ( | - | ||||||||||||||||||||||||||||||
870 | (*
| 0 | ||||||||||||||||||||||||||||||
871 | ==
| 0 | ||||||||||||||||||||||||||||||
872 | 1
| 0 | ||||||||||||||||||||||||||||||
873 | || | - | ||||||||||||||||||||||||||||||
874 | (*
| 0 | ||||||||||||||||||||||||||||||
875 | ==
| 0 | ||||||||||||||||||||||||||||||
876 | 22
| 0 | ||||||||||||||||||||||||||||||
877 | ) | - | ||||||||||||||||||||||||||||||
878 | { | - | ||||||||||||||||||||||||||||||
879 | - | |||||||||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||||||||
881 | int saved_errno = | - | ||||||||||||||||||||||||||||||
882 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
883 | ; | - | ||||||||||||||||||||||||||||||
884 | (__extension__ ({ __typeof__ (fchown (dest_desc, -1, gid)) __x = (fchown (dest_desc, -1, gid)); (void) __x; })); | - | ||||||||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||||||||
886 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
887 | = saved_errno; | - | ||||||||||||||||||||||||||||||
888 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
889 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
890 | else | - | ||||||||||||||||||||||||||||||
891 | { | - | ||||||||||||||||||||||||||||||
892 | if (lchown (dst_name, uid, gid) == 0
| 0-33933 | ||||||||||||||||||||||||||||||
893 | return executed 33933 times by 2 tests: 1;return 1; Executed by:
executed 33933 times by 2 tests: return 1; Executed by:
| 33933 | ||||||||||||||||||||||||||||||
894 | if ( | - | ||||||||||||||||||||||||||||||
895 | (*
| 0 | ||||||||||||||||||||||||||||||
896 | ==
| 0 | ||||||||||||||||||||||||||||||
897 | 1
| 0 | ||||||||||||||||||||||||||||||
898 | || | - | ||||||||||||||||||||||||||||||
899 | (*
| 0 | ||||||||||||||||||||||||||||||
900 | ==
| 0 | ||||||||||||||||||||||||||||||
901 | 22
| 0 | ||||||||||||||||||||||||||||||
902 | ) | - | ||||||||||||||||||||||||||||||
903 | { | - | ||||||||||||||||||||||||||||||
904 | - | |||||||||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||||||||
906 | int saved_errno = | - | ||||||||||||||||||||||||||||||
907 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
908 | ; | - | ||||||||||||||||||||||||||||||
909 | (__extension__ ({ __typeof__ (lchown (dst_name, -1, gid)) __x = (lchown (dst_name, -1, gid)); (void) __x; })); | - | ||||||||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||||||||
911 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
912 | = saved_errno; | - | ||||||||||||||||||||||||||||||
913 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
914 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
915 | - | |||||||||||||||||||||||||||||||
916 | if (! chown_failure_ok (x)
| 0 | ||||||||||||||||||||||||||||||
917 | { | - | ||||||||||||||||||||||||||||||
918 | error (0, | - | ||||||||||||||||||||||||||||||
919 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
920 | , | - | ||||||||||||||||||||||||||||||
921 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
922 | "failed to preserve ownership for %s" | - | ||||||||||||||||||||||||||||||
923 | , 5) | - | ||||||||||||||||||||||||||||||
924 | , | - | ||||||||||||||||||||||||||||||
925 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
926 | if (x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
927 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
928 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||||||||
930 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
931 | } | - | ||||||||||||||||||||||||||||||
932 | - | |||||||||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||||||||
934 | - | |||||||||||||||||||||||||||||||
935 | - | |||||||||||||||||||||||||||||||
936 | - | |||||||||||||||||||||||||||||||
937 | - | |||||||||||||||||||||||||||||||
938 | static void | - | ||||||||||||||||||||||||||||||
939 | set_author (const char *dst_name, int dest_desc, const struct stat *src_sb) | - | ||||||||||||||||||||||||||||||
940 | { | - | ||||||||||||||||||||||||||||||
941 | (void) dst_name; | - | ||||||||||||||||||||||||||||||
942 | (void) dest_desc; | - | ||||||||||||||||||||||||||||||
943 | (void) src_sb; | - | ||||||||||||||||||||||||||||||
944 | - | |||||||||||||||||||||||||||||||
945 | } executed 38433 times by 3 tests: end of block Executed by:
| 38433 | ||||||||||||||||||||||||||||||
946 | - | |||||||||||||||||||||||||||||||
947 | _Bool | - | ||||||||||||||||||||||||||||||
948 | - | |||||||||||||||||||||||||||||||
949 | set_process_security_ctx (char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
950 | mode_t mode, | - | ||||||||||||||||||||||||||||||
951 | _Bool | - | ||||||||||||||||||||||||||||||
952 | new_dst, const struct cp_options *x) | - | ||||||||||||||||||||||||||||||
953 | { | - | ||||||||||||||||||||||||||||||
954 | if (x->preserve_security_context
| 0-68505 | ||||||||||||||||||||||||||||||
955 | { | - | ||||||||||||||||||||||||||||||
956 | - | |||||||||||||||||||||||||||||||
957 | - | |||||||||||||||||||||||||||||||
958 | _Bool | - | ||||||||||||||||||||||||||||||
959 | all_errors = !x->data_copy_required
| 0 | ||||||||||||||||||||||||||||||
960 | - | |||||||||||||||||||||||||||||||
961 | _Bool | - | ||||||||||||||||||||||||||||||
962 | some_errors = !all_errors
| 0 | ||||||||||||||||||||||||||||||
963 | char *con; | - | ||||||||||||||||||||||||||||||
964 | - | |||||||||||||||||||||||||||||||
965 | if (0 <= rpl_lgetfilecon (src_name, &con)
| 0 | ||||||||||||||||||||||||||||||
966 | { | - | ||||||||||||||||||||||||||||||
967 | if (setfscreatecon (con) < 0
| 0 | ||||||||||||||||||||||||||||||
968 | { | - | ||||||||||||||||||||||||||||||
969 | if (all_errors
| 0 | ||||||||||||||||||||||||||||||
970 | (*__errno_location ())
| 0 | ||||||||||||||||||||||||||||||
971 | )
| 0 | ||||||||||||||||||||||||||||||
972 | error (0, never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
973 | (*__errno_location ()) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
974 | , never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
975 | never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
976 | dcgettext (((void *)0), never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
977 | "failed to set default file creation context to %s" never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
978 | , 5) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
979 | , never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
980 | quote (con)); never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set default file creation context to %s" , 5) , quote (con)); | 0 | ||||||||||||||||||||||||||||||
981 | if (x->require_preserve_context
| 0 | ||||||||||||||||||||||||||||||
982 | { | - | ||||||||||||||||||||||||||||||
983 | freecon (con); | - | ||||||||||||||||||||||||||||||
984 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
985 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
986 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
987 | } | - | ||||||||||||||||||||||||||||||
988 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
989 | freecon (con); | - | ||||||||||||||||||||||||||||||
990 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
991 | else | - | ||||||||||||||||||||||||||||||
992 | { | - | ||||||||||||||||||||||||||||||
993 | if (all_errors
| 0 | ||||||||||||||||||||||||||||||
994 | (*__errno_location ())
| 0 | ||||||||||||||||||||||||||||||
995 | )
| 0 | ||||||||||||||||||||||||||||||
996 | { | - | ||||||||||||||||||||||||||||||
997 | error (0, | - | ||||||||||||||||||||||||||||||
998 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
999 | , | - | ||||||||||||||||||||||||||||||
1000 | - | |||||||||||||||||||||||||||||||
1001 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1002 | "failed to get security context of %s" | - | ||||||||||||||||||||||||||||||
1003 | , 5) | - | ||||||||||||||||||||||||||||||
1004 | , | - | ||||||||||||||||||||||||||||||
1005 | quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
1006 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1007 | if (x->require_preserve_context
| 0 | ||||||||||||||||||||||||||||||
1008 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
1009 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
1010 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
1011 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1012 | } | - | ||||||||||||||||||||||||||||||
1013 | else if (x->set_security_context
| 0-68505 | ||||||||||||||||||||||||||||||
1014 | { | - | ||||||||||||||||||||||||||||||
1015 | - | |||||||||||||||||||||||||||||||
1016 | - | |||||||||||||||||||||||||||||||
1017 | if (new_dst
| 0 | ||||||||||||||||||||||||||||||
1018 | && ! ignorable_ctx_err (
| 0 | ||||||||||||||||||||||||||||||
1019 | (*__errno_location ())
| 0 | ||||||||||||||||||||||||||||||
1020 | )
| 0 | ||||||||||||||||||||||||||||||
1021 | { | - | ||||||||||||||||||||||||||||||
1022 | error (0, | - | ||||||||||||||||||||||||||||||
1023 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1024 | , | - | ||||||||||||||||||||||||||||||
1025 | - | |||||||||||||||||||||||||||||||
1026 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1027 | "failed to set default file creation context for %s" | - | ||||||||||||||||||||||||||||||
1028 | , 5) | - | ||||||||||||||||||||||||||||||
1029 | , | - | ||||||||||||||||||||||||||||||
1030 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1031 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1032 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1033 | - | |||||||||||||||||||||||||||||||
1034 | return executed 68505 times by 3 tests: return 1 ; Executed by:
executed 68505 times by 3 tests: return 1 ; Executed by:
| 68505 | ||||||||||||||||||||||||||||||
1035 | 1 executed 68505 times by 3 tests: return 1 ; Executed by:
| 68505 | ||||||||||||||||||||||||||||||
1036 | ; executed 68505 times by 3 tests: return 1 ; Executed by:
| 68505 | ||||||||||||||||||||||||||||||
1037 | } | - | ||||||||||||||||||||||||||||||
1038 | - | |||||||||||||||||||||||||||||||
1039 | _Bool | - | ||||||||||||||||||||||||||||||
1040 | - | |||||||||||||||||||||||||||||||
1041 | set_file_security_ctx (char const *dst_name, | - | ||||||||||||||||||||||||||||||
1042 | _Bool | - | ||||||||||||||||||||||||||||||
1043 | process_local, | - | ||||||||||||||||||||||||||||||
1044 | - | |||||||||||||||||||||||||||||||
1045 | _Bool | - | ||||||||||||||||||||||||||||||
1046 | recurse, const struct cp_options *x) | - | ||||||||||||||||||||||||||||||
1047 | { | - | ||||||||||||||||||||||||||||||
1048 | - | |||||||||||||||||||||||||||||||
1049 | _Bool | - | ||||||||||||||||||||||||||||||
1050 | all_errors = (!x->data_copy_required
| 0 | ||||||||||||||||||||||||||||||
1051 | || x->require_preserve_context
| 0 | ||||||||||||||||||||||||||||||
1052 | - | |||||||||||||||||||||||||||||||
1053 | _Bool | - | ||||||||||||||||||||||||||||||
1054 | some_errors = !all_errors
| 0 | ||||||||||||||||||||||||||||||
1055 | - | |||||||||||||||||||||||||||||||
1056 | if (! restorecon (dst_name, recurse, process_local)
| 0 | ||||||||||||||||||||||||||||||
1057 | { | - | ||||||||||||||||||||||||||||||
1058 | if (all_errors
| 0 | ||||||||||||||||||||||||||||||
1059 | (*__errno_location ())
| 0 | ||||||||||||||||||||||||||||||
1060 | )
| 0 | ||||||||||||||||||||||||||||||
1061 | error (0, never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1062 | (*__errno_location ()) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1063 | , never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1064 | dcgettext (((void *)0), never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1065 | "failed to set the security context of %s" never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1066 | , 5) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1067 | , never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1068 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "failed to set the security context of %s" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1069 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
1070 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
1071 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
1072 | } | - | ||||||||||||||||||||||||||||||
1073 | - | |||||||||||||||||||||||||||||||
1074 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1075 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1076 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1077 | } | - | ||||||||||||||||||||||||||||||
1078 | - | |||||||||||||||||||||||||||||||
1079 | - | |||||||||||||||||||||||||||||||
1080 | - | |||||||||||||||||||||||||||||||
1081 | - | |||||||||||||||||||||||||||||||
1082 | static int | - | ||||||||||||||||||||||||||||||
1083 | fchmod_or_lchmod (int desc, char const *name, mode_t mode) | - | ||||||||||||||||||||||||||||||
1084 | { | - | ||||||||||||||||||||||||||||||
1085 | - | |||||||||||||||||||||||||||||||
1086 | if (0 <= desc
| 0-1 | ||||||||||||||||||||||||||||||
1087 | return executed 1 time by 1 test: fchmod (desc, mode);return fchmod (desc, mode); Executed by:
executed 1 time by 1 test: return fchmod (desc, mode); Executed by:
| 1 | ||||||||||||||||||||||||||||||
1088 | - | |||||||||||||||||||||||||||||||
1089 | return never executed: return chmod (name, mode); never executed: return chmod (name, mode); | 0 | ||||||||||||||||||||||||||||||
1090 | chmod never executed: return chmod (name, mode); | 0 | ||||||||||||||||||||||||||||||
1091 | (name, mode); never executed: return chmod (name, mode); | 0 | ||||||||||||||||||||||||||||||
1092 | } | - | ||||||||||||||||||||||||||||||
1093 | static | - | ||||||||||||||||||||||||||||||
1094 | _Bool | - | ||||||||||||||||||||||||||||||
1095 | - | |||||||||||||||||||||||||||||||
1096 | is_probably_sparse (struct stat const *sb) | - | ||||||||||||||||||||||||||||||
1097 | { | - | ||||||||||||||||||||||||||||||
1098 | return executed 4455 times by 3 tests: (1return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1099 | && executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1100 | (((( executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1101 | sb->st_mode executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1102 | )) & 0170000) == (0100000)) executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1103 | executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1104 | && ((*sb).st_blocks) < sb->st_size / executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1105 | 512 executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1106 | ); executed 4455 times by 3 tests: return (1 && (((( sb->st_mode )) & 0170000) == (0100000)) && ((*sb).st_blocks) < sb->st_size / 512 ); Executed by:
| 4455 | ||||||||||||||||||||||||||||||
1107 | } | - | ||||||||||||||||||||||||||||||
1108 | static | - | ||||||||||||||||||||||||||||||
1109 | _Bool | - | ||||||||||||||||||||||||||||||
1110 | - | |||||||||||||||||||||||||||||||
1111 | copy_reg (char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
1112 | const struct cp_options *x, | - | ||||||||||||||||||||||||||||||
1113 | mode_t dst_mode, mode_t omitted_permissions, | - | ||||||||||||||||||||||||||||||
1114 | _Bool | - | ||||||||||||||||||||||||||||||
1115 | *new_dst, | - | ||||||||||||||||||||||||||||||
1116 | struct stat const *src_sb) | - | ||||||||||||||||||||||||||||||
1117 | { | - | ||||||||||||||||||||||||||||||
1118 | char *buf; | - | ||||||||||||||||||||||||||||||
1119 | char *buf_alloc = | - | ||||||||||||||||||||||||||||||
1120 | ((void *)0) | - | ||||||||||||||||||||||||||||||
1121 | ; | - | ||||||||||||||||||||||||||||||
1122 | char *name_alloc = | - | ||||||||||||||||||||||||||||||
1123 | ((void *)0) | - | ||||||||||||||||||||||||||||||
1124 | ; | - | ||||||||||||||||||||||||||||||
1125 | int dest_desc; | - | ||||||||||||||||||||||||||||||
1126 | int dest_errno; | - | ||||||||||||||||||||||||||||||
1127 | int source_desc; | - | ||||||||||||||||||||||||||||||
1128 | mode_t src_mode = src_sb->st_mode; | - | ||||||||||||||||||||||||||||||
1129 | struct stat sb; | - | ||||||||||||||||||||||||||||||
1130 | struct stat src_open_sb; | - | ||||||||||||||||||||||||||||||
1131 | - | |||||||||||||||||||||||||||||||
1132 | _Bool | - | ||||||||||||||||||||||||||||||
1133 | return_val = | - | ||||||||||||||||||||||||||||||
1134 | 1 | - | ||||||||||||||||||||||||||||||
1135 | ; | - | ||||||||||||||||||||||||||||||
1136 | - | |||||||||||||||||||||||||||||||
1137 | _Bool | - | ||||||||||||||||||||||||||||||
1138 | data_copy_required = x->data_copy_required; | - | ||||||||||||||||||||||||||||||
1139 | - | |||||||||||||||||||||||||||||||
1140 | source_desc = open_safer (src_name, | - | ||||||||||||||||||||||||||||||
1141 | ( | - | ||||||||||||||||||||||||||||||
1142 | 00 | - | ||||||||||||||||||||||||||||||
1143 | | | - | ||||||||||||||||||||||||||||||
1144 | 0 | - | ||||||||||||||||||||||||||||||
1145 | - | |||||||||||||||||||||||||||||||
1146 | | (x->dereference == DEREF_NEVER ? | - | ||||||||||||||||||||||||||||||
1147 | 0400000 | - | ||||||||||||||||||||||||||||||
1148 | : 0))); | - | ||||||||||||||||||||||||||||||
1149 | if (source_desc < 0
| 1-4461 | ||||||||||||||||||||||||||||||
1150 | { | - | ||||||||||||||||||||||||||||||
1151 | error (0, | - | ||||||||||||||||||||||||||||||
1152 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1153 | , | - | ||||||||||||||||||||||||||||||
1154 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1155 | "cannot open %s for reading" | - | ||||||||||||||||||||||||||||||
1156 | , 5) | - | ||||||||||||||||||||||||||||||
1157 | , quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
1158 | return executed 1 time by 1 test: return 0 ; Executed by:
executed 1 time by 1 test: return 0 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1159 | 0 executed 1 time by 1 test: return 0 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1160 | ; executed 1 time by 1 test: return 0 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1161 | } | - | ||||||||||||||||||||||||||||||
1162 | - | |||||||||||||||||||||||||||||||
1163 | if (fstat (source_desc, &src_open_sb) != 0
| 0-4461 | ||||||||||||||||||||||||||||||
1164 | { | - | ||||||||||||||||||||||||||||||
1165 | error (0, | - | ||||||||||||||||||||||||||||||
1166 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1167 | , | - | ||||||||||||||||||||||||||||||
1168 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1169 | "cannot fstat %s" | - | ||||||||||||||||||||||||||||||
1170 | , 5) | - | ||||||||||||||||||||||||||||||
1171 | , quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
1172 | return_val = | - | ||||||||||||||||||||||||||||||
1173 | 0 | - | ||||||||||||||||||||||||||||||
1174 | ; | - | ||||||||||||||||||||||||||||||
1175 | goto never executed: close_src_desc;goto close_src_desc; never executed: goto close_src_desc; | 0 | ||||||||||||||||||||||||||||||
1176 | } | - | ||||||||||||||||||||||||||||||
1177 | - | |||||||||||||||||||||||||||||||
1178 | - | |||||||||||||||||||||||||||||||
1179 | - | |||||||||||||||||||||||||||||||
1180 | if (! ((*
| 0-4461 | ||||||||||||||||||||||||||||||
1181 | { | - | ||||||||||||||||||||||||||||||
1182 | error (0, 0, | - | ||||||||||||||||||||||||||||||
1183 | - | |||||||||||||||||||||||||||||||
1184 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1185 | "skipping file %s, as it was replaced while being copied" | - | ||||||||||||||||||||||||||||||
1186 | , 5) | - | ||||||||||||||||||||||||||||||
1187 | , | - | ||||||||||||||||||||||||||||||
1188 | quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
1189 | return_val = | - | ||||||||||||||||||||||||||||||
1190 | 0 | - | ||||||||||||||||||||||||||||||
1191 | ; | - | ||||||||||||||||||||||||||||||
1192 | goto never executed: close_src_desc;goto close_src_desc; never executed: goto close_src_desc; | 0 | ||||||||||||||||||||||||||||||
1193 | } | - | ||||||||||||||||||||||||||||||
1194 | - | |||||||||||||||||||||||||||||||
1195 | - | |||||||||||||||||||||||||||||||
1196 | - | |||||||||||||||||||||||||||||||
1197 | if (! *new_dst
| 98-4363 | ||||||||||||||||||||||||||||||
1198 | { | - | ||||||||||||||||||||||||||||||
1199 | int open_flags = | - | ||||||||||||||||||||||||||||||
1200 | - | |||||||||||||||||||||||||||||||
1201 | 01 | - | ||||||||||||||||||||||||||||||
1202 | | | - | ||||||||||||||||||||||||||||||
1203 | 0 | - | ||||||||||||||||||||||||||||||
1204 | | (x->data_copy_required ? | - | ||||||||||||||||||||||||||||||
1205 | 01000 | - | ||||||||||||||||||||||||||||||
1206 | : 0); | - | ||||||||||||||||||||||||||||||
1207 | dest_desc = open_safer (dst_name, open_flags); | - | ||||||||||||||||||||||||||||||
1208 | dest_errno = | - | ||||||||||||||||||||||||||||||
1209 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1210 | ; | - | ||||||||||||||||||||||||||||||
1211 | if ((x->set_security_context
| 0-98 | ||||||||||||||||||||||||||||||
1212 | && 0 <= dest_desc
| 0 | ||||||||||||||||||||||||||||||
1213 | { | - | ||||||||||||||||||||||||||||||
1214 | if (! set_file_security_ctx (dst_name, x->preserve_security_context,
| 0 | ||||||||||||||||||||||||||||||
1215 |
| 0 | ||||||||||||||||||||||||||||||
1216 | 0
| 0 | ||||||||||||||||||||||||||||||
1217 | , x)
| 0 | ||||||||||||||||||||||||||||||
1218 | { | - | ||||||||||||||||||||||||||||||
1219 | if (x->require_preserve_context
| 0 | ||||||||||||||||||||||||||||||
1220 | { | - | ||||||||||||||||||||||||||||||
1221 | return_val = | - | ||||||||||||||||||||||||||||||
1222 | 0 | - | ||||||||||||||||||||||||||||||
1223 | ; | - | ||||||||||||||||||||||||||||||
1224 | goto never executed: close_src_and_dst_desc;goto close_src_and_dst_desc; never executed: goto close_src_and_dst_desc; | 0 | ||||||||||||||||||||||||||||||
1225 | } | - | ||||||||||||||||||||||||||||||
1226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1228 | - | |||||||||||||||||||||||||||||||
1229 | if (dest_desc < 0
| 0-91 | ||||||||||||||||||||||||||||||
1230 | { | - | ||||||||||||||||||||||||||||||
1231 | if (unlink (dst_name) != 0
| 0-7 | ||||||||||||||||||||||||||||||
1232 | { | - | ||||||||||||||||||||||||||||||
1233 | error (0, | - | ||||||||||||||||||||||||||||||
1234 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1235 | , | - | ||||||||||||||||||||||||||||||
1236 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1237 | "cannot remove %s" | - | ||||||||||||||||||||||||||||||
1238 | , 5) | - | ||||||||||||||||||||||||||||||
1239 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1240 | return_val = | - | ||||||||||||||||||||||||||||||
1241 | 0 | - | ||||||||||||||||||||||||||||||
1242 | ; | - | ||||||||||||||||||||||||||||||
1243 | goto never executed: close_src_desc;goto close_src_desc; never executed: goto close_src_desc; | 0 | ||||||||||||||||||||||||||||||
1244 | } | - | ||||||||||||||||||||||||||||||
1245 | if (x->verbose
| 0-7 | ||||||||||||||||||||||||||||||
1246 | printf ( never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1247 | dcgettext (((void *)0), never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1248 | "removed %s\n" never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1249 | , 5) never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1250 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
1251 | - | |||||||||||||||||||||||||||||||
1252 | - | |||||||||||||||||||||||||||||||
1253 | *new_dst = | - | ||||||||||||||||||||||||||||||
1254 | 1 | - | ||||||||||||||||||||||||||||||
1255 | ; | - | ||||||||||||||||||||||||||||||
1256 | - | |||||||||||||||||||||||||||||||
1257 | - | |||||||||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||||||||
1259 | if (x->set_security_context
| 0-7 | ||||||||||||||||||||||||||||||
1260 | { | - | ||||||||||||||||||||||||||||||
1261 | if (! set_process_security_ctx (src_name, dst_name, dst_mode,
| 0 | ||||||||||||||||||||||||||||||
1262 | *new_dst, x)
| 0 | ||||||||||||||||||||||||||||||
1263 | { | - | ||||||||||||||||||||||||||||||
1264 | return_val = | - | ||||||||||||||||||||||||||||||
1265 | 0 | - | ||||||||||||||||||||||||||||||
1266 | ; | - | ||||||||||||||||||||||||||||||
1267 | goto never executed: close_src_desc;goto close_src_desc; never executed: goto close_src_desc; | 0 | ||||||||||||||||||||||||||||||
1268 | } | - | ||||||||||||||||||||||||||||||
1269 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1270 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||||||||||||||
1271 | } executed 98 times by 1 test: end of block Executed by:
| 98 | ||||||||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||||||||
1273 | if (*
| 91-4370 | ||||||||||||||||||||||||||||||
1274 | { | - | ||||||||||||||||||||||||||||||
1275 | open_with_O_CREAT:; | - | ||||||||||||||||||||||||||||||
1276 | - | |||||||||||||||||||||||||||||||
1277 | int open_flags = | - | ||||||||||||||||||||||||||||||
1278 | 01 | - | ||||||||||||||||||||||||||||||
1279 | | | - | ||||||||||||||||||||||||||||||
1280 | 0100 | - | ||||||||||||||||||||||||||||||
1281 | | | - | ||||||||||||||||||||||||||||||
1282 | 0 | - | ||||||||||||||||||||||||||||||
1283 | ; | - | ||||||||||||||||||||||||||||||
1284 | dest_desc = open_safer (dst_name, open_flags | | - | ||||||||||||||||||||||||||||||
1285 | 0200 | - | ||||||||||||||||||||||||||||||
1286 | , | - | ||||||||||||||||||||||||||||||
1287 | dst_mode & ~omitted_permissions); | - | ||||||||||||||||||||||||||||||
1288 | dest_errno = | - | ||||||||||||||||||||||||||||||
1289 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1290 | ; | - | ||||||||||||||||||||||||||||||
1291 | if (dest_desc < 0
| 1-4367 | ||||||||||||||||||||||||||||||
1292 | 17
| 1-2 | ||||||||||||||||||||||||||||||
1293 | && ! x->move_mode
| 0-2 | ||||||||||||||||||||||||||||||
1294 | { | - | ||||||||||||||||||||||||||||||
1295 | struct stat dangling_link_sb; | - | ||||||||||||||||||||||||||||||
1296 | if (lstat (dst_name, &dangling_link_sb) == 0
| 0-2 | ||||||||||||||||||||||||||||||
1297 | && | - | ||||||||||||||||||||||||||||||
1298 | ((((
| 0-2 | ||||||||||||||||||||||||||||||
1299 | dangling_link_sb.st_mode
| 0-2 | ||||||||||||||||||||||||||||||
1300 | )) & 0170000) == (0120000))
| 0-2 | ||||||||||||||||||||||||||||||
1301 | ) | - | ||||||||||||||||||||||||||||||
1302 | { | - | ||||||||||||||||||||||||||||||
1303 | if (x->open_dangling_dest_symlink
| 1 | ||||||||||||||||||||||||||||||
1304 | { | - | ||||||||||||||||||||||||||||||
1305 | dest_desc = open_safer (dst_name, open_flags, | - | ||||||||||||||||||||||||||||||
1306 | dst_mode & ~omitted_permissions); | - | ||||||||||||||||||||||||||||||
1307 | dest_errno = | - | ||||||||||||||||||||||||||||||
1308 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1309 | ; | - | ||||||||||||||||||||||||||||||
1310 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
1311 | else | - | ||||||||||||||||||||||||||||||
1312 | { | - | ||||||||||||||||||||||||||||||
1313 | error (0, 0, | - | ||||||||||||||||||||||||||||||
1314 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1315 | "not writing through dangling symlink %s" | - | ||||||||||||||||||||||||||||||
1316 | , 5) | - | ||||||||||||||||||||||||||||||
1317 | , | - | ||||||||||||||||||||||||||||||
1318 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1319 | return_val = | - | ||||||||||||||||||||||||||||||
1320 | 0 | - | ||||||||||||||||||||||||||||||
1321 | ; | - | ||||||||||||||||||||||||||||||
1322 | goto executed 1 time by 1 test: close_src_desc;goto close_src_desc; Executed by:
executed 1 time by 1 test: goto close_src_desc; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1323 | } | - | ||||||||||||||||||||||||||||||
1324 | } | - | ||||||||||||||||||||||||||||||
1325 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||||||||
1327 | - | |||||||||||||||||||||||||||||||
1328 | - | |||||||||||||||||||||||||||||||
1329 | if (dest_desc < 0
| 0-4368 | ||||||||||||||||||||||||||||||
1330 | 21
| 0-1 | ||||||||||||||||||||||||||||||
1331 | - | |||||||||||||||||||||||||||||||
1332 | && *
| 0-1 | ||||||||||||||||||||||||||||||
1333 | dest_errno = executed 1 time by 1 test: dest_errno = 20 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1334 | 20 executed 1 time by 1 test: dest_errno = 20 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1335 | ; executed 1 time by 1 test: dest_errno = 20 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1336 | } executed 4369 times by 3 tests: end of block Executed by:
| 4369 | ||||||||||||||||||||||||||||||
1337 | else | - | ||||||||||||||||||||||||||||||
1338 | { | - | ||||||||||||||||||||||||||||||
1339 | omitted_permissions = 0; | - | ||||||||||||||||||||||||||||||
1340 | } executed 91 times by 1 test: end of block Executed by:
| 91 | ||||||||||||||||||||||||||||||
1341 | - | |||||||||||||||||||||||||||||||
1342 | if (dest_desc < 0
| 1-4459 | ||||||||||||||||||||||||||||||
1343 | { | - | ||||||||||||||||||||||||||||||
1344 | if (dest_errno ==
| 0-1 | ||||||||||||||||||||||||||||||
1345 | 2
| 0-1 | ||||||||||||||||||||||||||||||
1346 | && ! *new_dst
| 0 | ||||||||||||||||||||||||||||||
1347 | { | - | ||||||||||||||||||||||||||||||
1348 | *new_dst = 1; | - | ||||||||||||||||||||||||||||||
1349 | goto never executed: open_with_O_CREAT;goto open_with_O_CREAT; never executed: goto open_with_O_CREAT; | 0 | ||||||||||||||||||||||||||||||
1350 | } | - | ||||||||||||||||||||||||||||||
1351 | - | |||||||||||||||||||||||||||||||
1352 | - | |||||||||||||||||||||||||||||||
1353 | error (0, dest_errno, | - | ||||||||||||||||||||||||||||||
1354 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1355 | "cannot create regular file %s" | - | ||||||||||||||||||||||||||||||
1356 | , 5) | - | ||||||||||||||||||||||||||||||
1357 | , | - | ||||||||||||||||||||||||||||||
1358 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1359 | return_val = | - | ||||||||||||||||||||||||||||||
1360 | 0 | - | ||||||||||||||||||||||||||||||
1361 | ; | - | ||||||||||||||||||||||||||||||
1362 | goto executed 1 time by 1 test: close_src_desc;goto close_src_desc; Executed by:
executed 1 time by 1 test: goto close_src_desc; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1363 | } | - | ||||||||||||||||||||||||||||||
1364 | - | |||||||||||||||||||||||||||||||
1365 | if (fstat (dest_desc, &sb) != 0
| 0-4459 | ||||||||||||||||||||||||||||||
1366 | { | - | ||||||||||||||||||||||||||||||
1367 | error (0, | - | ||||||||||||||||||||||||||||||
1368 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1369 | , | - | ||||||||||||||||||||||||||||||
1370 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1371 | "cannot fstat %s" | - | ||||||||||||||||||||||||||||||
1372 | , 5) | - | ||||||||||||||||||||||||||||||
1373 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1374 | return_val = | - | ||||||||||||||||||||||||||||||
1375 | 0 | - | ||||||||||||||||||||||||||||||
1376 | ; | - | ||||||||||||||||||||||||||||||
1377 | goto never executed: close_src_and_dst_desc;goto close_src_and_dst_desc; never executed: goto close_src_and_dst_desc; | 0 | ||||||||||||||||||||||||||||||
1378 | } | - | ||||||||||||||||||||||||||||||
1379 | - | |||||||||||||||||||||||||||||||
1380 | - | |||||||||||||||||||||||||||||||
1381 | if (data_copy_required
| 3-4456 | ||||||||||||||||||||||||||||||
1382 | { | - | ||||||||||||||||||||||||||||||
1383 | - | |||||||||||||||||||||||||||||||
1384 | _Bool | - | ||||||||||||||||||||||||||||||
1385 | clone_ok = clone_file (dest_desc, source_desc) == 0; | - | ||||||||||||||||||||||||||||||
1386 | if (clone_ok
| 0-3923 | ||||||||||||||||||||||||||||||
1387 | { | - | ||||||||||||||||||||||||||||||
1388 | if (!clone_ok
| 0-1 | ||||||||||||||||||||||||||||||
1389 | { | - | ||||||||||||||||||||||||||||||
1390 | error (0, | - | ||||||||||||||||||||||||||||||
1391 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1392 | , | - | ||||||||||||||||||||||||||||||
1393 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1394 | "failed to clone %s from %s" | - | ||||||||||||||||||||||||||||||
1395 | , 5) | - | ||||||||||||||||||||||||||||||
1396 | , | - | ||||||||||||||||||||||||||||||
1397 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name), quotearg_n_style (1, shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
1398 | return_val = | - | ||||||||||||||||||||||||||||||
1399 | 0 | - | ||||||||||||||||||||||||||||||
1400 | ; | - | ||||||||||||||||||||||||||||||
1401 | goto executed 1 time by 1 test: close_src_and_dst_desc;goto close_src_and_dst_desc; Executed by:
executed 1 time by 1 test: goto close_src_and_dst_desc; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1402 | } | - | ||||||||||||||||||||||||||||||
1403 | data_copy_required = | - | ||||||||||||||||||||||||||||||
1404 | 0 | - | ||||||||||||||||||||||||||||||
1405 | ; | - | ||||||||||||||||||||||||||||||
1406 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1407 | } executed 3922 times by 2 tests: end of block Executed by:
| 3922 | ||||||||||||||||||||||||||||||
1408 | - | |||||||||||||||||||||||||||||||
1409 | if (data_copy_required
| 3-4455 | ||||||||||||||||||||||||||||||
1410 | { | - | ||||||||||||||||||||||||||||||
1411 | - | |||||||||||||||||||||||||||||||
1412 | size_t buf_alignment = getpagesize (); | - | ||||||||||||||||||||||||||||||
1413 | size_t buf_size = io_blksize (sb); | - | ||||||||||||||||||||||||||||||
1414 | size_t hole_size = ((0 < (sb).st_blksize
| 0-4455 | ||||||||||||||||||||||||||||||
1415 | 512 | - | ||||||||||||||||||||||||||||||
1416 | ); | - | ||||||||||||||||||||||||||||||
1417 | - | |||||||||||||||||||||||||||||||
1418 | fdadvise (source_desc, 0, 0, FADVISE_SEQUENTIAL); | - | ||||||||||||||||||||||||||||||
1419 | - | |||||||||||||||||||||||||||||||
1420 | - | |||||||||||||||||||||||||||||||
1421 | - | |||||||||||||||||||||||||||||||
1422 | _Bool | - | ||||||||||||||||||||||||||||||
1423 | make_holes = | - | ||||||||||||||||||||||||||||||
1424 | 0 | - | ||||||||||||||||||||||||||||||
1425 | ; | - | ||||||||||||||||||||||||||||||
1426 | - | |||||||||||||||||||||||||||||||
1427 | _Bool | - | ||||||||||||||||||||||||||||||
1428 | sparse_src = is_probably_sparse (&src_open_sb); | - | ||||||||||||||||||||||||||||||
1429 | - | |||||||||||||||||||||||||||||||
1430 | if ( | - | ||||||||||||||||||||||||||||||
1431 | ((((
| 1-4454 | ||||||||||||||||||||||||||||||
1432 | sb.st_mode
| 1-4454 | ||||||||||||||||||||||||||||||
1433 | )) & 0170000) == (0100000))
| 1-4454 | ||||||||||||||||||||||||||||||
1434 | ) | - | ||||||||||||||||||||||||||||||
1435 | { | - | ||||||||||||||||||||||||||||||
1436 | - | |||||||||||||||||||||||||||||||
1437 | - | |||||||||||||||||||||||||||||||
1438 | if (x->sparse_mode == SPARSE_ALWAYS
| 76-4378 | ||||||||||||||||||||||||||||||
1439 | make_holes = executed 76 times by 1 test: make_holes = 1 ; Executed by:
| 76 | ||||||||||||||||||||||||||||||
1440 | 1 executed 76 times by 1 test: make_holes = 1 ; Executed by:
| 76 | ||||||||||||||||||||||||||||||
1441 | ; executed 76 times by 1 test: make_holes = 1 ; Executed by:
| 76 | ||||||||||||||||||||||||||||||
1442 | - | |||||||||||||||||||||||||||||||
1443 | - | |||||||||||||||||||||||||||||||
1444 | - | |||||||||||||||||||||||||||||||
1445 | - | |||||||||||||||||||||||||||||||
1446 | - | |||||||||||||||||||||||||||||||
1447 | if (x->sparse_mode == SPARSE_AUTO
| 8-4373 | ||||||||||||||||||||||||||||||
1448 | make_holes = executed 8 times by 1 test: make_holes = 1 ; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1449 | 1 executed 8 times by 1 test: make_holes = 1 ; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1450 | ; executed 8 times by 1 test: make_holes = 1 ; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1451 | } executed 4454 times by 3 tests: end of block Executed by:
| 4454 | ||||||||||||||||||||||||||||||
1452 | - | |||||||||||||||||||||||||||||||
1453 | - | |||||||||||||||||||||||||||||||
1454 | - | |||||||||||||||||||||||||||||||
1455 | if (! make_holes
| 84-4371 | ||||||||||||||||||||||||||||||
1456 | { | - | ||||||||||||||||||||||||||||||
1457 | - | |||||||||||||||||||||||||||||||
1458 | - | |||||||||||||||||||||||||||||||
1459 | size_t blcm_max = | - | ||||||||||||||||||||||||||||||
1460 | ((((
| 0-4371 | ||||||||||||||||||||||||||||||
1461 | - buf_alignment; | - | ||||||||||||||||||||||||||||||
1462 | size_t blcm = buffer_lcm (io_blksize (src_open_sb), buf_size, | - | ||||||||||||||||||||||||||||||
1463 | blcm_max); | - | ||||||||||||||||||||||||||||||
1464 | - | |||||||||||||||||||||||||||||||
1465 | - | |||||||||||||||||||||||||||||||
1466 | - | |||||||||||||||||||||||||||||||
1467 | if ( | - | ||||||||||||||||||||||||||||||
1468 | ((((
| 4-4367 | ||||||||||||||||||||||||||||||
1469 | src_open_sb.st_mode
| 4-4367 | ||||||||||||||||||||||||||||||
1470 | )) & 0170000) == (0100000))
| 4-4367 | ||||||||||||||||||||||||||||||
1471 | && src_open_sb.st_size < buf_size
| 11-4356 | ||||||||||||||||||||||||||||||
1472 | buf_size = src_open_sb.st_size + 1; executed 4356 times by 3 tests: buf_size = src_open_sb.st_size + 1; Executed by:
| 4356 | ||||||||||||||||||||||||||||||
1473 | - | |||||||||||||||||||||||||||||||
1474 | - | |||||||||||||||||||||||||||||||
1475 | - | |||||||||||||||||||||||||||||||
1476 | - | |||||||||||||||||||||||||||||||
1477 | buf_size += blcm - 1; | - | ||||||||||||||||||||||||||||||
1478 | buf_size -= buf_size % blcm; | - | ||||||||||||||||||||||||||||||
1479 | if (buf_size == 0
| 0-4371 | ||||||||||||||||||||||||||||||
1480 | buf_size = blcm; never executed: buf_size = blcm; | 0 | ||||||||||||||||||||||||||||||
1481 | } executed 4371 times by 3 tests: end of block Executed by:
| 4371 | ||||||||||||||||||||||||||||||
1482 | - | |||||||||||||||||||||||||||||||
1483 | buf_alloc = xmalloc (buf_size + buf_alignment); | - | ||||||||||||||||||||||||||||||
1484 | buf = ptr_align (buf_alloc, buf_alignment); | - | ||||||||||||||||||||||||||||||
1485 | - | |||||||||||||||||||||||||||||||
1486 | if (sparse_src
| 65-4390 | ||||||||||||||||||||||||||||||
1487 | { | - | ||||||||||||||||||||||||||||||
1488 | - | |||||||||||||||||||||||||||||||
1489 | _Bool | - | ||||||||||||||||||||||||||||||
1490 | normal_copy_required; | - | ||||||||||||||||||||||||||||||
1491 | - | |||||||||||||||||||||||||||||||
1492 | - | |||||||||||||||||||||||||||||||
1493 | - | |||||||||||||||||||||||||||||||
1494 | - | |||||||||||||||||||||||||||||||
1495 | - | |||||||||||||||||||||||||||||||
1496 | if (extent_copy (source_desc, dest_desc, buf, buf_size, hole_size,
| 5-60 | ||||||||||||||||||||||||||||||
1497 | src_open_sb.st_size,
| 5-60 | ||||||||||||||||||||||||||||||
1498 | make_holes ? x->sparse_mode : SPARSE_NEVER,
| 5-60 | ||||||||||||||||||||||||||||||
1499 | src_name, dst_name, &normal_copy_required)
| 5-60 | ||||||||||||||||||||||||||||||
1500 | goto executed 60 times by 1 test: preserve_metadata;goto preserve_metadata; Executed by:
executed 60 times by 1 test: goto preserve_metadata; Executed by:
| 60 | ||||||||||||||||||||||||||||||
1501 | - | |||||||||||||||||||||||||||||||
1502 | if (! normal_copy_required
| 0-5 | ||||||||||||||||||||||||||||||
1503 | { | - | ||||||||||||||||||||||||||||||
1504 | return_val = | - | ||||||||||||||||||||||||||||||
1505 | 0 | - | ||||||||||||||||||||||||||||||
1506 | ; | - | ||||||||||||||||||||||||||||||
1507 | goto never executed: close_src_and_dst_desc;goto close_src_and_dst_desc; never executed: goto close_src_and_dst_desc; | 0 | ||||||||||||||||||||||||||||||
1508 | } | - | ||||||||||||||||||||||||||||||
1509 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||
1510 | - | |||||||||||||||||||||||||||||||
1511 | off_t n_read; | - | ||||||||||||||||||||||||||||||
1512 | - | |||||||||||||||||||||||||||||||
1513 | _Bool | - | ||||||||||||||||||||||||||||||
1514 | wrote_hole_at_eof; | - | ||||||||||||||||||||||||||||||
1515 | if (! sparse_copy (source_desc, dest_desc, buf, buf_size,
| 0-4395 | ||||||||||||||||||||||||||||||
1516 | make_holes ? hole_size : 0,
| 0-4395 | ||||||||||||||||||||||||||||||
1517 | x->sparse_mode == SPARSE_ALWAYS, src_name, dst_name,
| 0-4395 | ||||||||||||||||||||||||||||||
1518 |
| 0-4395 | ||||||||||||||||||||||||||||||
1519 | (18446744073709551615UL)
| 0-4395 | ||||||||||||||||||||||||||||||
1520 | , &n_read,
| 0-4395 | ||||||||||||||||||||||||||||||
1521 | &wrote_hole_at_eof)
| 0-4395 | ||||||||||||||||||||||||||||||
1522 | { | - | ||||||||||||||||||||||||||||||
1523 | return_val = | - | ||||||||||||||||||||||||||||||
1524 | 0 | - | ||||||||||||||||||||||||||||||
1525 | ; | - | ||||||||||||||||||||||||||||||
1526 | goto never executed: close_src_and_dst_desc;goto close_src_and_dst_desc; never executed: goto close_src_and_dst_desc; | 0 | ||||||||||||||||||||||||||||||
1527 | } | - | ||||||||||||||||||||||||||||||
1528 | else if (wrote_hole_at_eof
| 0-4387 | ||||||||||||||||||||||||||||||
1529 | { | - | ||||||||||||||||||||||||||||||
1530 | error (0, | - | ||||||||||||||||||||||||||||||
1531 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1532 | , | - | ||||||||||||||||||||||||||||||
1533 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1534 | "failed to extend %s" | - | ||||||||||||||||||||||||||||||
1535 | , 5) | - | ||||||||||||||||||||||||||||||
1536 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1537 | return_val = | - | ||||||||||||||||||||||||||||||
1538 | 0 | - | ||||||||||||||||||||||||||||||
1539 | ; | - | ||||||||||||||||||||||||||||||
1540 | goto never executed: close_src_and_dst_desc;goto close_src_and_dst_desc; never executed: goto close_src_and_dst_desc; | 0 | ||||||||||||||||||||||||||||||
1541 | } | - | ||||||||||||||||||||||||||||||
1542 | } executed 4395 times by 3 tests: end of block Executed by:
| 4395 | ||||||||||||||||||||||||||||||
1543 | - | |||||||||||||||||||||||||||||||
1544 | preserve_metadata: code before this statement executed 4398 times by 3 tests: preserve_metadata: Executed by:
| 4398 | ||||||||||||||||||||||||||||||
1545 | if (x->preserve_timestamps
| 529-3929 | ||||||||||||||||||||||||||||||
1546 | { | - | ||||||||||||||||||||||||||||||
1547 | struct timespec timespec[2]; | - | ||||||||||||||||||||||||||||||
1548 | timespec[0] = get_stat_atime (src_sb); | - | ||||||||||||||||||||||||||||||
1549 | timespec[1] = get_stat_mtime (src_sb); | - | ||||||||||||||||||||||||||||||
1550 | - | |||||||||||||||||||||||||||||||
1551 | if (fdutimens (dest_desc, dst_name, timespec) != 0
| 0-3929 | ||||||||||||||||||||||||||||||
1552 | { | - | ||||||||||||||||||||||||||||||
1553 | error (0, | - | ||||||||||||||||||||||||||||||
1554 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1555 | , | - | ||||||||||||||||||||||||||||||
1556 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1557 | "preserving times for %s" | - | ||||||||||||||||||||||||||||||
1558 | , 5) | - | ||||||||||||||||||||||||||||||
1559 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1560 | if (x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
1561 | { | - | ||||||||||||||||||||||||||||||
1562 | return_val = | - | ||||||||||||||||||||||||||||||
1563 | 0 | - | ||||||||||||||||||||||||||||||
1564 | ; | - | ||||||||||||||||||||||||||||||
1565 | goto never executed: close_src_and_dst_desc;goto close_src_and_dst_desc; never executed: goto close_src_and_dst_desc; | 0 | ||||||||||||||||||||||||||||||
1566 | } | - | ||||||||||||||||||||||||||||||
1567 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1568 | } executed 3929 times by 2 tests: end of block Executed by:
| 3929 | ||||||||||||||||||||||||||||||
1569 | - | |||||||||||||||||||||||||||||||
1570 | - | |||||||||||||||||||||||||||||||
1571 | - | |||||||||||||||||||||||||||||||
1572 | if (x->preserve_ownership
| 0-3930 | ||||||||||||||||||||||||||||||
1573 | { | - | ||||||||||||||||||||||||||||||
1574 | switch (set_owner (x, dst_name, dest_desc, src_sb, *new_dst, &sb)) | - | ||||||||||||||||||||||||||||||
1575 | { | - | ||||||||||||||||||||||||||||||
1576 | case never executed: -1:case -1: never executed: case -1: | 0 | ||||||||||||||||||||||||||||||
1577 | return_val = | - | ||||||||||||||||||||||||||||||
1578 | 0 | - | ||||||||||||||||||||||||||||||
1579 | ; | - | ||||||||||||||||||||||||||||||
1580 | goto never executed: close_src_and_dst_desc;goto close_src_and_dst_desc; never executed: goto close_src_and_dst_desc; | 0 | ||||||||||||||||||||||||||||||
1581 | - | |||||||||||||||||||||||||||||||
1582 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||||||||||||||
1583 | src_mode &= ~ ( | - | ||||||||||||||||||||||||||||||
1584 | 04000 | - | ||||||||||||||||||||||||||||||
1585 | | | - | ||||||||||||||||||||||||||||||
1586 | 02000 | - | ||||||||||||||||||||||||||||||
1587 | | | - | ||||||||||||||||||||||||||||||
1588 | 01000 | - | ||||||||||||||||||||||||||||||
1589 | ); | - | ||||||||||||||||||||||||||||||
1590 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1591 | } | - | ||||||||||||||||||||||||||||||
1592 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
1593 | - | |||||||||||||||||||||||||||||||
1594 | - | |||||||||||||||||||||||||||||||
1595 | - | |||||||||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||||||||
1597 | if (x->preserve_xattr
| 536-3922 | ||||||||||||||||||||||||||||||
1598 | { | - | ||||||||||||||||||||||||||||||
1599 | - | |||||||||||||||||||||||||||||||
1600 | _Bool | - | ||||||||||||||||||||||||||||||
1601 | access_changed = | - | ||||||||||||||||||||||||||||||
1602 | 0 | - | ||||||||||||||||||||||||||||||
1603 | ; | - | ||||||||||||||||||||||||||||||
1604 | - | |||||||||||||||||||||||||||||||
1605 | if (!(sb.st_mode &
| 0-3922 | ||||||||||||||||||||||||||||||
1606 | 0200
| 0-3922 | ||||||||||||||||||||||||||||||
1607 | )
| 0-3922 | ||||||||||||||||||||||||||||||
1608 | { | - | ||||||||||||||||||||||||||||||
1609 | access_changed = fchmod_or_lchmod (dest_desc, dst_name, | - | ||||||||||||||||||||||||||||||
1610 | - | |||||||||||||||||||||||||||||||
1611 | 0400 | - | ||||||||||||||||||||||||||||||
1612 | | | - | ||||||||||||||||||||||||||||||
1613 | 0200 | - | ||||||||||||||||||||||||||||||
1614 | ) == 0; | - | ||||||||||||||||||||||||||||||
1615 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1616 | - | |||||||||||||||||||||||||||||||
1617 | if (!copy_attr (src_name, source_desc, dst_name, dest_desc, x)
| 0-3922 | ||||||||||||||||||||||||||||||
1618 | && x->require_preserve_xattr
| 0 | ||||||||||||||||||||||||||||||
1619 | return_val = never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1620 | 0 never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1621 | ; never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1622 | - | |||||||||||||||||||||||||||||||
1623 | if (access_changed
| 0-3922 | ||||||||||||||||||||||||||||||
1624 | fchmod_or_lchmod (dest_desc, dst_name, dst_mode & ~omitted_permissions); never executed: fchmod_or_lchmod (dest_desc, dst_name, dst_mode & ~omitted_permissions); | 0 | ||||||||||||||||||||||||||||||
1625 | } executed 3922 times by 2 tests: end of block Executed by:
| 3922 | ||||||||||||||||||||||||||||||
1626 | - | |||||||||||||||||||||||||||||||
1627 | set_author (dst_name, dest_desc, src_sb); | - | ||||||||||||||||||||||||||||||
1628 | - | |||||||||||||||||||||||||||||||
1629 | if (x->preserve_mode
| 0-3930 | ||||||||||||||||||||||||||||||
1630 | { | - | ||||||||||||||||||||||||||||||
1631 | if (copy_acl (src_name, source_desc, dst_name, dest_desc, src_mode) != 0
| 0-3930 | ||||||||||||||||||||||||||||||
1632 | && x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
1633 | return_val = never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1634 | 0 never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1635 | ; never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1636 | } executed 3930 times by 2 tests: end of block Executed by:
| 3930 | ||||||||||||||||||||||||||||||
1637 | else if (x->set_mode
| 22-506 | ||||||||||||||||||||||||||||||
1638 | { | - | ||||||||||||||||||||||||||||||
1639 | if (set_acl (dst_name, dest_desc, x->mode) != 0
| 0-22 | ||||||||||||||||||||||||||||||
1640 | return_val = never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1641 | 0 never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1642 | ; never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1643 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||||||||||||||
1644 | else if (x->explicit_no_preserve_mode
| 3-503 | ||||||||||||||||||||||||||||||
1645 | { | - | ||||||||||||||||||||||||||||||
1646 | if (set_acl (dst_name, dest_desc, (
| 0-3 | ||||||||||||||||||||||||||||||
1647 | 0400
| 0-3 | ||||||||||||||||||||||||||||||
1648 | |
| 0-3 | ||||||||||||||||||||||||||||||
1649 | 0200
| 0-3 | ||||||||||||||||||||||||||||||
1650 | |
| 0-3 | ||||||||||||||||||||||||||||||
1651 | (0400 >> 3)
| 0-3 | ||||||||||||||||||||||||||||||
1652 | |
| 0-3 | ||||||||||||||||||||||||||||||
1653 | (0200 >> 3)
| 0-3 | ||||||||||||||||||||||||||||||
1654 | |
| 0-3 | ||||||||||||||||||||||||||||||
1655 | ((0400 >> 3) >> 3)
| 0-3 | ||||||||||||||||||||||||||||||
1656 | |
| 0-3 | ||||||||||||||||||||||||||||||
1657 | ((0200 >> 3) >> 3)
| 0-3 | ||||||||||||||||||||||||||||||
1658 | ) & ~cached_umask ()) != 0
| 0-3 | ||||||||||||||||||||||||||||||
1659 | return_val = never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1660 | 0 never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1661 | ; never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1662 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||||||||
1663 | else if (omitted_permissions
| 1-502 | ||||||||||||||||||||||||||||||
1664 | { | - | ||||||||||||||||||||||||||||||
1665 | omitted_permissions &= ~ cached_umask (); | - | ||||||||||||||||||||||||||||||
1666 | if (omitted_permissions
| 0-1 | ||||||||||||||||||||||||||||||
1667 | && fchmod_or_lchmod (dest_desc, dst_name, dst_mode) != 0
| 0-1 | ||||||||||||||||||||||||||||||
1668 | { | - | ||||||||||||||||||||||||||||||
1669 | error (0, | - | ||||||||||||||||||||||||||||||
1670 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1671 | , | - | ||||||||||||||||||||||||||||||
1672 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1673 | "preserving permissions for %s" | - | ||||||||||||||||||||||||||||||
1674 | , 5) | - | ||||||||||||||||||||||||||||||
1675 | , | - | ||||||||||||||||||||||||||||||
1676 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1677 | if (x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
1678 | return_val = never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1679 | 0 never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1680 | ; never executed: return_val = 0 ; | 0 | ||||||||||||||||||||||||||||||
1681 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1682 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
1683 | - | |||||||||||||||||||||||||||||||
1684 | close_src_and_dst_desc: code before this statement executed 4458 times by 3 tests: close_src_and_dst_desc: Executed by:
| 4458 | ||||||||||||||||||||||||||||||
1685 | if (close (dest_desc) < 0
| 0-4459 | ||||||||||||||||||||||||||||||
1686 | { | - | ||||||||||||||||||||||||||||||
1687 | error (0, | - | ||||||||||||||||||||||||||||||
1688 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1689 | , | - | ||||||||||||||||||||||||||||||
1690 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1691 | "failed to close %s" | - | ||||||||||||||||||||||||||||||
1692 | , 5) | - | ||||||||||||||||||||||||||||||
1693 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
1694 | return_val = | - | ||||||||||||||||||||||||||||||
1695 | 0 | - | ||||||||||||||||||||||||||||||
1696 | ; | - | ||||||||||||||||||||||||||||||
1697 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1698 | close_src_desc: code before this statement executed 4459 times by 3 tests: close_src_desc: Executed by:
| 4459 | ||||||||||||||||||||||||||||||
1699 | if (close (source_desc) < 0
| 0-4461 | ||||||||||||||||||||||||||||||
1700 | { | - | ||||||||||||||||||||||||||||||
1701 | error (0, | - | ||||||||||||||||||||||||||||||
1702 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
1703 | , | - | ||||||||||||||||||||||||||||||
1704 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
1705 | "failed to close %s" | - | ||||||||||||||||||||||||||||||
1706 | , 5) | - | ||||||||||||||||||||||||||||||
1707 | , quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
1708 | return_val = | - | ||||||||||||||||||||||||||||||
1709 | 0 | - | ||||||||||||||||||||||||||||||
1710 | ; | - | ||||||||||||||||||||||||||||||
1711 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1712 | - | |||||||||||||||||||||||||||||||
1713 | free (buf_alloc); | - | ||||||||||||||||||||||||||||||
1714 | free (name_alloc); | - | ||||||||||||||||||||||||||||||
1715 | return executed 4461 times by 3 tests: return_val;return return_val; Executed by:
executed 4461 times by 3 tests: return return_val; Executed by:
| 4461 | ||||||||||||||||||||||||||||||
1716 | } | - | ||||||||||||||||||||||||||||||
1717 | static | - | ||||||||||||||||||||||||||||||
1718 | _Bool | - | ||||||||||||||||||||||||||||||
1719 | - | |||||||||||||||||||||||||||||||
1720 | same_file_ok (char const *src_name, struct stat const *src_sb, | - | ||||||||||||||||||||||||||||||
1721 | char const *dst_name, struct stat const *dst_sb, | - | ||||||||||||||||||||||||||||||
1722 | const struct cp_options *x, | - | ||||||||||||||||||||||||||||||
1723 | _Bool | - | ||||||||||||||||||||||||||||||
1724 | *return_now) | - | ||||||||||||||||||||||||||||||
1725 | { | - | ||||||||||||||||||||||||||||||
1726 | const struct stat *src_sb_link; | - | ||||||||||||||||||||||||||||||
1727 | const struct stat *dst_sb_link; | - | ||||||||||||||||||||||||||||||
1728 | struct stat tmp_dst_sb; | - | ||||||||||||||||||||||||||||||
1729 | struct stat tmp_src_sb; | - | ||||||||||||||||||||||||||||||
1730 | - | |||||||||||||||||||||||||||||||
1731 | - | |||||||||||||||||||||||||||||||
1732 | _Bool | - | ||||||||||||||||||||||||||||||
1733 | same_link; | - | ||||||||||||||||||||||||||||||
1734 | - | |||||||||||||||||||||||||||||||
1735 | _Bool | - | ||||||||||||||||||||||||||||||
1736 | same = ((*
| 0-803 | ||||||||||||||||||||||||||||||
1737 | - | |||||||||||||||||||||||||||||||
1738 | *return_now = | - | ||||||||||||||||||||||||||||||
1739 | 0 | - | ||||||||||||||||||||||||||||||
1740 | ; | - | ||||||||||||||||||||||||||||||
1741 | - | |||||||||||||||||||||||||||||||
1742 | - | |||||||||||||||||||||||||||||||
1743 | - | |||||||||||||||||||||||||||||||
1744 | - | |||||||||||||||||||||||||||||||
1745 | - | |||||||||||||||||||||||||||||||
1746 | - | |||||||||||||||||||||||||||||||
1747 | if (same
| 23-803 | ||||||||||||||||||||||||||||||
1748 | { | - | ||||||||||||||||||||||||||||||
1749 | *return_now = | - | ||||||||||||||||||||||||||||||
1750 | 1 | - | ||||||||||||||||||||||||||||||
1751 | ; | - | ||||||||||||||||||||||||||||||
1752 | return executed 23 times by 1 test: return 1 ; Executed by:
executed 23 times by 1 test: return 1 ; Executed by:
| 23 | ||||||||||||||||||||||||||||||
1753 | 1 executed 23 times by 1 test: return 1 ; Executed by:
| 23 | ||||||||||||||||||||||||||||||
1754 | ; executed 23 times by 1 test: return 1 ; Executed by:
| 23 | ||||||||||||||||||||||||||||||
1755 | } | - | ||||||||||||||||||||||||||||||
1756 | - | |||||||||||||||||||||||||||||||
1757 | if (x->dereference == DEREF_NEVER
| 208-651 | ||||||||||||||||||||||||||||||
1758 | { | - | ||||||||||||||||||||||||||||||
1759 | same_link = same; | - | ||||||||||||||||||||||||||||||
1760 | - | |||||||||||||||||||||||||||||||
1761 | - | |||||||||||||||||||||||||||||||
1762 | - | |||||||||||||||||||||||||||||||
1763 | - | |||||||||||||||||||||||||||||||
1764 | if ( | - | ||||||||||||||||||||||||||||||
1765 | ((((
| 32-619 | ||||||||||||||||||||||||||||||
1766 | src_sb->st_mode
| 32-619 | ||||||||||||||||||||||||||||||
1767 | )) & 0170000) == (0120000))
| 32-619 | ||||||||||||||||||||||||||||||
1768 | && | - | ||||||||||||||||||||||||||||||
1769 | ((((
| 15-17 | ||||||||||||||||||||||||||||||
1770 | dst_sb->st_mode
| 15-17 | ||||||||||||||||||||||||||||||
1771 | )) & 0170000) == (0120000))
| 15-17 | ||||||||||||||||||||||||||||||
1772 | ) | - | ||||||||||||||||||||||||||||||
1773 | { | - | ||||||||||||||||||||||||||||||
1774 | - | |||||||||||||||||||||||||||||||
1775 | _Bool | - | ||||||||||||||||||||||||||||||
1776 | sn = same_name (src_name, dst_name); | - | ||||||||||||||||||||||||||||||
1777 | if ( ! sn
| 1-14 | ||||||||||||||||||||||||||||||
1778 | { | - | ||||||||||||||||||||||||||||||
1779 | - | |||||||||||||||||||||||||||||||
1780 | if (x->backup_type != no_backups
| 5-9 | ||||||||||||||||||||||||||||||
1781 | return executed 5 times by 2 tests: return 1 ; Executed by:
executed 5 times by 2 tests: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
1782 | 1 executed 5 times by 2 tests: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
1783 | ; executed 5 times by 2 tests: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
1784 | - | |||||||||||||||||||||||||||||||
1785 | - | |||||||||||||||||||||||||||||||
1786 | - | |||||||||||||||||||||||||||||||
1787 | - | |||||||||||||||||||||||||||||||
1788 | - | |||||||||||||||||||||||||||||||
1789 | if (same_link
| 3-6 | ||||||||||||||||||||||||||||||
1790 | { | - | ||||||||||||||||||||||||||||||
1791 | *return_now = | - | ||||||||||||||||||||||||||||||
1792 | 1 | - | ||||||||||||||||||||||||||||||
1793 | ; | - | ||||||||||||||||||||||||||||||
1794 | return executed 3 times by 2 tests: ! x->move_mode;return ! x->move_mode; Executed by:
executed 3 times by 2 tests: return ! x->move_mode; Executed by:
| 3 | ||||||||||||||||||||||||||||||
1795 | } | - | ||||||||||||||||||||||||||||||
1796 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
1797 | - | |||||||||||||||||||||||||||||||
1798 | return executed 7 times by 2 tests: ! sn;return ! sn; Executed by:
executed 7 times by 2 tests: return ! sn; Executed by:
| 7 | ||||||||||||||||||||||||||||||
1799 | } | - | ||||||||||||||||||||||||||||||
1800 | - | |||||||||||||||||||||||||||||||
1801 | src_sb_link = src_sb; | - | ||||||||||||||||||||||||||||||
1802 | dst_sb_link = dst_sb; | - | ||||||||||||||||||||||||||||||
1803 | } executed 636 times by 2 tests: end of block Executed by:
| 636 | ||||||||||||||||||||||||||||||
1804 | else | - | ||||||||||||||||||||||||||||||
1805 | { | - | ||||||||||||||||||||||||||||||
1806 | if (!same
| 30-178 | ||||||||||||||||||||||||||||||
1807 | return executed 178 times by 2 tests: return 1 ; Executed by:
executed 178 times by 2 tests: return 1 ; Executed by:
| 178 | ||||||||||||||||||||||||||||||
1808 | 1 executed 178 times by 2 tests: return 1 ; Executed by:
| 178 | ||||||||||||||||||||||||||||||
1809 | ; executed 178 times by 2 tests: return 1 ; Executed by:
| 178 | ||||||||||||||||||||||||||||||
1810 | - | |||||||||||||||||||||||||||||||
1811 | if (lstat (dst_name, &tmp_dst_sb) != 0
| 0-30 | ||||||||||||||||||||||||||||||
1812 | || lstat (src_name, &tmp_src_sb) != 0
| 0-30 | ||||||||||||||||||||||||||||||
1813 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1814 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1815 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1816 | - | |||||||||||||||||||||||||||||||
1817 | src_sb_link = &tmp_src_sb; | - | ||||||||||||||||||||||||||||||
1818 | dst_sb_link = &tmp_dst_sb; | - | ||||||||||||||||||||||||||||||
1819 | - | |||||||||||||||||||||||||||||||
1820 | same_link = ((*
| 0-19 | ||||||||||||||||||||||||||||||
1821 | - | |||||||||||||||||||||||||||||||
1822 | - | |||||||||||||||||||||||||||||||
1823 | - | |||||||||||||||||||||||||||||||
1824 | - | |||||||||||||||||||||||||||||||
1825 | - | |||||||||||||||||||||||||||||||
1826 | - | |||||||||||||||||||||||||||||||
1827 | if ( | - | ||||||||||||||||||||||||||||||
1828 | ((((
| 13-17 | ||||||||||||||||||||||||||||||
1829 | src_sb_link->st_mode
| 13-17 | ||||||||||||||||||||||||||||||
1830 | )) & 0170000) == (0120000))
| 13-17 | ||||||||||||||||||||||||||||||
1831 | && | - | ||||||||||||||||||||||||||||||
1832 | ((((
| 4-13 | ||||||||||||||||||||||||||||||
1833 | dst_sb_link->st_mode
| 4-13 | ||||||||||||||||||||||||||||||
1834 | )) & 0170000) == (0120000))
| 4-13 | ||||||||||||||||||||||||||||||
1835 | - | |||||||||||||||||||||||||||||||
1836 | && x->unlink_dest_before_opening
| 0-4 | ||||||||||||||||||||||||||||||
1837 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1838 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1839 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1840 | } executed 30 times by 1 test: end of block Executed by:
| 30 | ||||||||||||||||||||||||||||||
1841 | - | |||||||||||||||||||||||||||||||
1842 | - | |||||||||||||||||||||||||||||||
1843 | - | |||||||||||||||||||||||||||||||
1844 | - | |||||||||||||||||||||||||||||||
1845 | - | |||||||||||||||||||||||||||||||
1846 | - | |||||||||||||||||||||||||||||||
1847 | if (x->backup_type != no_backups
| 56-610 | ||||||||||||||||||||||||||||||
1848 | { | - | ||||||||||||||||||||||||||||||
1849 | if (!same_link
| 7-49 | ||||||||||||||||||||||||||||||
1850 | { | - | ||||||||||||||||||||||||||||||
1851 | if ( ! x->move_mode
| 18-31 | ||||||||||||||||||||||||||||||
1852 | && x->dereference != DEREF_NEVER
| 6-12 | ||||||||||||||||||||||||||||||
1853 | && | - | ||||||||||||||||||||||||||||||
1854 | ((((
| 0-6 | ||||||||||||||||||||||||||||||
1855 | src_sb_link->st_mode
| 0-6 | ||||||||||||||||||||||||||||||
1856 | )) & 0170000) == (0120000))
| 0-6 | ||||||||||||||||||||||||||||||
1857 | - | |||||||||||||||||||||||||||||||
1858 | && !
| 0-6 | ||||||||||||||||||||||||||||||
1859 | ((((
| 0-6 | ||||||||||||||||||||||||||||||
1860 | dst_sb_link->st_mode
| 0-6 | ||||||||||||||||||||||||||||||
1861 | )) & 0170000) == (0120000))
| 0-6 | ||||||||||||||||||||||||||||||
1862 | ) | - | ||||||||||||||||||||||||||||||
1863 | return executed 6 times by 1 test: return 0 ; Executed by:
executed 6 times by 1 test: return 0 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1864 | 0 executed 6 times by 1 test: return 0 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1865 | ; executed 6 times by 1 test: return 0 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1866 | - | |||||||||||||||||||||||||||||||
1867 | return executed 43 times by 2 tests: return 1 ; Executed by:
executed 43 times by 2 tests: return 1 ; Executed by:
| 43 | ||||||||||||||||||||||||||||||
1868 | 1 executed 43 times by 2 tests: return 1 ; Executed by:
| 43 | ||||||||||||||||||||||||||||||
1869 | ; executed 43 times by 2 tests: return 1 ; Executed by:
| 43 | ||||||||||||||||||||||||||||||
1870 | } | - | ||||||||||||||||||||||||||||||
1871 | - | |||||||||||||||||||||||||||||||
1872 | - | |||||||||||||||||||||||||||||||
1873 | return executed 7 times by 2 tests: ! same_name (src_name, dst_name);return ! same_name (src_name, dst_name); Executed by:
executed 7 times by 2 tests: return ! same_name (src_name, dst_name); Executed by:
| 7 | ||||||||||||||||||||||||||||||
1874 | } | - | ||||||||||||||||||||||||||||||
1875 | if (x->move_mode
| 10-545 | ||||||||||||||||||||||||||||||
1876 | { | - | ||||||||||||||||||||||||||||||
1877 | - | |||||||||||||||||||||||||||||||
1878 | - | |||||||||||||||||||||||||||||||
1879 | - | |||||||||||||||||||||||||||||||
1880 | - | |||||||||||||||||||||||||||||||
1881 | if ( | - | ||||||||||||||||||||||||||||||
1882 | ((((
| 6-549 | ||||||||||||||||||||||||||||||
1883 | dst_sb_link->st_mode
| 6-549 | ||||||||||||||||||||||||||||||
1884 | )) & 0170000) == (0120000))
| 6-549 | ||||||||||||||||||||||||||||||
1885 | ) | - | ||||||||||||||||||||||||||||||
1886 | return executed 6 times by 2 tests: return 1 ; Executed by:
executed 6 times by 2 tests: return 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1887 | 1 executed 6 times by 2 tests: return 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1888 | ; executed 6 times by 2 tests: return 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1889 | - | |||||||||||||||||||||||||||||||
1890 | - | |||||||||||||||||||||||||||||||
1891 | - | |||||||||||||||||||||||||||||||
1892 | if (same_link
| 6-543 | ||||||||||||||||||||||||||||||
1893 | && 1 < dst_sb_link->st_nlink
| 1-5 | ||||||||||||||||||||||||||||||
1894 | && ! same_name (src_name, dst_name)
| 1-4 | ||||||||||||||||||||||||||||||
1895 | return executed 4 times by 2 tests: ! x->move_mode;return ! x->move_mode; Executed by:
executed 4 times by 2 tests: return ! x->move_mode; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1896 | } executed 545 times by 2 tests: end of block Executed by:
| 545 | ||||||||||||||||||||||||||||||
1897 | - | |||||||||||||||||||||||||||||||
1898 | - | |||||||||||||||||||||||||||||||
1899 | - | |||||||||||||||||||||||||||||||
1900 | if (!
| 22-578 | ||||||||||||||||||||||||||||||
1901 | ((((
| 22-578 | ||||||||||||||||||||||||||||||
1902 | src_sb_link->st_mode
| 22-578 | ||||||||||||||||||||||||||||||
1903 | )) & 0170000) == (0120000))
| 22-578 | ||||||||||||||||||||||||||||||
1904 | && !
| 6-572 | ||||||||||||||||||||||||||||||
1905 | ((((
| 6-572 | ||||||||||||||||||||||||||||||
1906 | dst_sb_link->st_mode
| 6-572 | ||||||||||||||||||||||||||||||
1907 | )) & 0170000) == (0120000))
| 6-572 | ||||||||||||||||||||||||||||||
1908 | ) | - | ||||||||||||||||||||||||||||||
1909 | { | - | ||||||||||||||||||||||||||||||
1910 | if (!((*
| 0-555 | ||||||||||||||||||||||||||||||
1911 | return executed 555 times by 2 tests: return 1 ; Executed by:
executed 555 times by 2 tests: return 1 ; Executed by:
| 555 | ||||||||||||||||||||||||||||||
1912 | 1 executed 555 times by 2 tests: return 1 ; Executed by:
| 555 | ||||||||||||||||||||||||||||||
1913 | ; executed 555 times by 2 tests: return 1 ; Executed by:
| 555 | ||||||||||||||||||||||||||||||
1914 | - | |||||||||||||||||||||||||||||||
1915 | - | |||||||||||||||||||||||||||||||
1916 | if (x->hard_link
| 0-17 | ||||||||||||||||||||||||||||||
1917 | { | - | ||||||||||||||||||||||||||||||
1918 | *return_now = | - | ||||||||||||||||||||||||||||||
1919 | 1 | - | ||||||||||||||||||||||||||||||
1920 | ; | - | ||||||||||||||||||||||||||||||
1921 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1922 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1923 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1924 | } | - | ||||||||||||||||||||||||||||||
1925 | } executed 17 times by 2 tests: end of block Executed by:
| 17 | ||||||||||||||||||||||||||||||
1926 | if (x->move_mode
| 5-40 | ||||||||||||||||||||||||||||||
1927 | && | - | ||||||||||||||||||||||||||||||
1928 | ((((
| 1-4 | ||||||||||||||||||||||||||||||
1929 | src_sb->st_mode
| 1-4 | ||||||||||||||||||||||||||||||
1930 | )) & 0170000) == (0120000))
| 1-4 | ||||||||||||||||||||||||||||||
1931 | - | |||||||||||||||||||||||||||||||
1932 | && 1 < dst_sb_link->st_nlink
| 1-3 | ||||||||||||||||||||||||||||||
1933 | { | - | ||||||||||||||||||||||||||||||
1934 | char *abs_src = canonicalize_file_name (src_name); | - | ||||||||||||||||||||||||||||||
1935 | if (abs_src
| 0-1 | ||||||||||||||||||||||||||||||
1936 | { | - | ||||||||||||||||||||||||||||||
1937 | - | |||||||||||||||||||||||||||||||
1938 | _Bool | - | ||||||||||||||||||||||||||||||
1939 | result = ! same_name (abs_src, dst_name); | - | ||||||||||||||||||||||||||||||
1940 | free (abs_src); | - | ||||||||||||||||||||||||||||||
1941 | return executed 1 time by 1 test: result;return result; Executed by:
executed 1 time by 1 test: return result; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1942 | } | - | ||||||||||||||||||||||||||||||
1943 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1944 | - | |||||||||||||||||||||||||||||||
1945 | - | |||||||||||||||||||||||||||||||
1946 | - | |||||||||||||||||||||||||||||||
1947 | - | |||||||||||||||||||||||||||||||
1948 | - | |||||||||||||||||||||||||||||||
1949 | if (x->symbolic_link
| 0-44 | ||||||||||||||||||||||||||||||
1950 | || ((x->hard_link
| 3-41 | ||||||||||||||||||||||||||||||
1951 | && | - | ||||||||||||||||||||||||||||||
1952 | ((((
| 2-7 | ||||||||||||||||||||||||||||||
1953 | dst_sb_link->st_mode
| 2-7 | ||||||||||||||||||||||||||||||
1954 | )) & 0170000) == (0120000))
| 2-7 | ||||||||||||||||||||||||||||||
1955 | )) | - | ||||||||||||||||||||||||||||||
1956 | return executed 2 times by 1 test: dst_sb_link->st_dev == src_sb_link->st_dev;return dst_sb_link->st_dev == src_sb_link->st_dev; Executed by:
executed 2 times by 1 test: return dst_sb_link->st_dev == src_sb_link->st_dev; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1957 | - | |||||||||||||||||||||||||||||||
1958 | if (x->dereference == DEREF_NEVER
| 20-22 | ||||||||||||||||||||||||||||||
1959 | { | - | ||||||||||||||||||||||||||||||
1960 | if ( !
| 10-12 | ||||||||||||||||||||||||||||||
1961 | ((((
| 10-12 | ||||||||||||||||||||||||||||||
1962 | src_sb_link->st_mode
| 10-12 | ||||||||||||||||||||||||||||||
1963 | )) & 0170000) == (0120000))
| 10-12 | ||||||||||||||||||||||||||||||
1964 | ) | - | ||||||||||||||||||||||||||||||
1965 | tmp_src_sb = *src_sb_link; executed 12 times by 2 tests: tmp_src_sb = *src_sb_link; Executed by:
| 12 | ||||||||||||||||||||||||||||||
1966 | else if (stat (src_name, &tmp_src_sb) != 0
| 0-10 | ||||||||||||||||||||||||||||||
1967 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1968 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1969 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1970 | - | |||||||||||||||||||||||||||||||
1971 | if ( !
| 0-22 | ||||||||||||||||||||||||||||||
1972 | ((((
| 0-22 | ||||||||||||||||||||||||||||||
1973 | dst_sb_link->st_mode
| 0-22 | ||||||||||||||||||||||||||||||
1974 | )) & 0170000) == (0120000))
| 0-22 | ||||||||||||||||||||||||||||||
1975 | ) | - | ||||||||||||||||||||||||||||||
1976 | tmp_dst_sb = *dst_sb_link; executed 22 times by 2 tests: tmp_dst_sb = *dst_sb_link; Executed by:
| 22 | ||||||||||||||||||||||||||||||
1977 | else if (stat (dst_name, &tmp_dst_sb) != 0
| 0 | ||||||||||||||||||||||||||||||
1978 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1979 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1980 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1981 | - | |||||||||||||||||||||||||||||||
1982 | if ( ! ((
| 0-22 | ||||||||||||||||||||||||||||||
1983 | return never executed: return 1 ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1984 | 1 never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1985 | ; never executed: return 1 ; | 0 | ||||||||||||||||||||||||||||||
1986 | - | |||||||||||||||||||||||||||||||
1987 | - | |||||||||||||||||||||||||||||||
1988 | if (x->hard_link
| 1-21 | ||||||||||||||||||||||||||||||
1989 | { | - | ||||||||||||||||||||||||||||||
1990 | *return_now = | - | ||||||||||||||||||||||||||||||
1991 | 1 | - | ||||||||||||||||||||||||||||||
1992 | ; | - | ||||||||||||||||||||||||||||||
1993 | return executed 1 time by 1 test: return 1 ; Executed by:
executed 1 time by 1 test: return 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1994 | 1 executed 1 time by 1 test: return 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1995 | ; executed 1 time by 1 test: return 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1996 | } | - | ||||||||||||||||||||||||||||||
1997 | } executed 21 times by 2 tests: end of block Executed by:
| 21 | ||||||||||||||||||||||||||||||
1998 | - | |||||||||||||||||||||||||||||||
1999 | return executed 41 times by 2 tests: return 0 ; Executed by:
executed 41 times by 2 tests: return 0 ; Executed by:
| 41 | ||||||||||||||||||||||||||||||
2000 | 0 executed 41 times by 2 tests: return 0 ; Executed by:
| 41 | ||||||||||||||||||||||||||||||
2001 | ; executed 41 times by 2 tests: return 0 ; Executed by:
| 41 | ||||||||||||||||||||||||||||||
2002 | } | - | ||||||||||||||||||||||||||||||
2003 | - | |||||||||||||||||||||||||||||||
2004 | - | |||||||||||||||||||||||||||||||
2005 | - | |||||||||||||||||||||||||||||||
2006 | static | - | ||||||||||||||||||||||||||||||
2007 | _Bool | - | ||||||||||||||||||||||||||||||
2008 | - | |||||||||||||||||||||||||||||||
2009 | writable_destination (char const *file, mode_t mode) | - | ||||||||||||||||||||||||||||||
2010 | { | - | ||||||||||||||||||||||||||||||
2011 | return executed 13 times by 2 tests: (return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2012 | (((( executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2013 | mode executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2014 | )) & 0170000) == (0120000)) executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2015 | executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2016 | || can_write_any_file () executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2017 | || euidaccess (file, executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2018 | 2 executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2019 | ) == 0); executed 13 times by 2 tests: return ( (((( mode )) & 0170000) == (0120000)) || can_write_any_file () || euidaccess (file, 2 ) == 0); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2020 | } | - | ||||||||||||||||||||||||||||||
2021 | - | |||||||||||||||||||||||||||||||
2022 | static | - | ||||||||||||||||||||||||||||||
2023 | _Bool | - | ||||||||||||||||||||||||||||||
2024 | - | |||||||||||||||||||||||||||||||
2025 | overwrite_ok (struct cp_options const *x, char const *dst_name, | - | ||||||||||||||||||||||||||||||
2026 | struct stat const *dst_sb) | - | ||||||||||||||||||||||||||||||
2027 | { | - | ||||||||||||||||||||||||||||||
2028 | if (! writable_destination (dst_name, dst_sb->st_mode)
| 3-10 | ||||||||||||||||||||||||||||||
2029 | { | - | ||||||||||||||||||||||||||||||
2030 | char perms[12]; | - | ||||||||||||||||||||||||||||||
2031 | strmode (dst_sb->st_mode, perms); | - | ||||||||||||||||||||||||||||||
2032 | perms[10] = '\0'; | - | ||||||||||||||||||||||||||||||
2033 | fprintf ( | - | ||||||||||||||||||||||||||||||
2034 | stderr | - | ||||||||||||||||||||||||||||||
2035 | , | - | ||||||||||||||||||||||||||||||
2036 | (x->move_mode || x->unlink_dest_before_opening | - | ||||||||||||||||||||||||||||||
2037 | || x->unlink_dest_after_failed_open) | - | ||||||||||||||||||||||||||||||
2038 | ? | - | ||||||||||||||||||||||||||||||
2039 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2040 | "%s: replace %s, overriding mode %04lo (%s)? " | - | ||||||||||||||||||||||||||||||
2041 | , 5) | - | ||||||||||||||||||||||||||||||
2042 | - | |||||||||||||||||||||||||||||||
2043 | : | - | ||||||||||||||||||||||||||||||
2044 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2045 | "%s: unwritable %s (mode %04lo, %s); try anyway? " | - | ||||||||||||||||||||||||||||||
2046 | , 5) | - | ||||||||||||||||||||||||||||||
2047 | , | - | ||||||||||||||||||||||||||||||
2048 | program_name, quotearg_style (shell_escape_always_quoting_style, dst_name), | - | ||||||||||||||||||||||||||||||
2049 | (unsigned long int) (dst_sb->st_mode & ( | - | ||||||||||||||||||||||||||||||
2050 | 04000 | - | ||||||||||||||||||||||||||||||
2051 | | | - | ||||||||||||||||||||||||||||||
2052 | 02000 | - | ||||||||||||||||||||||||||||||
2053 | | | - | ||||||||||||||||||||||||||||||
2054 | 01000 | - | ||||||||||||||||||||||||||||||
2055 | | | - | ||||||||||||||||||||||||||||||
2056 | (0400|0200|0100) | - | ||||||||||||||||||||||||||||||
2057 | | | - | ||||||||||||||||||||||||||||||
2058 | ((0400|0200|0100) >> 3) | - | ||||||||||||||||||||||||||||||
2059 | | | - | ||||||||||||||||||||||||||||||
2060 | (((0400|0200|0100) >> 3) >> 3) | - | ||||||||||||||||||||||||||||||
2061 | )), | - | ||||||||||||||||||||||||||||||
2062 | &perms[1]); | - | ||||||||||||||||||||||||||||||
2063 | } executed 3 times by 2 tests: end of block Executed by:
| 3 | ||||||||||||||||||||||||||||||
2064 | else | - | ||||||||||||||||||||||||||||||
2065 | { | - | ||||||||||||||||||||||||||||||
2066 | fprintf ( | - | ||||||||||||||||||||||||||||||
2067 | stderr | - | ||||||||||||||||||||||||||||||
2068 | , | - | ||||||||||||||||||||||||||||||
2069 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2070 | "%s: overwrite %s? " | - | ||||||||||||||||||||||||||||||
2071 | , 5) | - | ||||||||||||||||||||||||||||||
2072 | , | - | ||||||||||||||||||||||||||||||
2073 | program_name, quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2074 | } executed 10 times by 2 tests: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||
2075 | - | |||||||||||||||||||||||||||||||
2076 | return executed 13 times by 2 tests: yesno ();return yesno (); Executed by:
executed 13 times by 2 tests: return yesno (); Executed by:
| 13 | ||||||||||||||||||||||||||||||
2077 | } | - | ||||||||||||||||||||||||||||||
2078 | - | |||||||||||||||||||||||||||||||
2079 | - | |||||||||||||||||||||||||||||||
2080 | - | |||||||||||||||||||||||||||||||
2081 | extern void | - | ||||||||||||||||||||||||||||||
2082 | dest_info_init (struct cp_options *x) | - | ||||||||||||||||||||||||||||||
2083 | { | - | ||||||||||||||||||||||||||||||
2084 | x->dest_info | - | ||||||||||||||||||||||||||||||
2085 | = hash_initialize (61, | - | ||||||||||||||||||||||||||||||
2086 | - | |||||||||||||||||||||||||||||||
2087 | ((void *)0) | - | ||||||||||||||||||||||||||||||
2088 | , | - | ||||||||||||||||||||||||||||||
2089 | triple_hash, | - | ||||||||||||||||||||||||||||||
2090 | triple_compare, | - | ||||||||||||||||||||||||||||||
2091 | triple_free); | - | ||||||||||||||||||||||||||||||
2092 | } executed 42 times by 3 tests: end of block Executed by:
| 42 | ||||||||||||||||||||||||||||||
2093 | - | |||||||||||||||||||||||||||||||
2094 | - | |||||||||||||||||||||||||||||||
2095 | - | |||||||||||||||||||||||||||||||
2096 | extern void | - | ||||||||||||||||||||||||||||||
2097 | src_info_init (struct cp_options *x) | - | ||||||||||||||||||||||||||||||
2098 | { | - | ||||||||||||||||||||||||||||||
2099 | x->src_info | - | ||||||||||||||||||||||||||||||
2100 | = hash_initialize (61, | - | ||||||||||||||||||||||||||||||
2101 | - | |||||||||||||||||||||||||||||||
2102 | ((void *)0) | - | ||||||||||||||||||||||||||||||
2103 | , | - | ||||||||||||||||||||||||||||||
2104 | triple_hash_no_name, | - | ||||||||||||||||||||||||||||||
2105 | triple_compare, | - | ||||||||||||||||||||||||||||||
2106 | triple_free); | - | ||||||||||||||||||||||||||||||
2107 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||||||||||||||||||||
2108 | - | |||||||||||||||||||||||||||||||
2109 | - | |||||||||||||||||||||||||||||||
2110 | - | |||||||||||||||||||||||||||||||
2111 | - | |||||||||||||||||||||||||||||||
2112 | - | |||||||||||||||||||||||||||||||
2113 | - | |||||||||||||||||||||||||||||||
2114 | - | |||||||||||||||||||||||||||||||
2115 | static | - | ||||||||||||||||||||||||||||||
2116 | _Bool | - | ||||||||||||||||||||||||||||||
2117 | - | |||||||||||||||||||||||||||||||
2118 | abandon_move (const struct cp_options *x, | - | ||||||||||||||||||||||||||||||
2119 | char const *dst_name, | - | ||||||||||||||||||||||||||||||
2120 | struct stat const *dst_sb) | - | ||||||||||||||||||||||||||||||
2121 | { | - | ||||||||||||||||||||||||||||||
2122 | - | |||||||||||||||||||||||||||||||
2123 | (( | - | ||||||||||||||||||||||||||||||
2124 | x->move_mode | - | ||||||||||||||||||||||||||||||
2125 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
2126 | "x->move_mode" | - | ||||||||||||||||||||||||||||||
2127 | , "src/copy.c", 1748, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
2128 | ; | - | ||||||||||||||||||||||||||||||
2129 | return executed 572 times by 1 test: (x->interactive == I_ALWAYS_NOreturn (x->interactive == I_ALWAYS_NO || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty && ! writable_destination (dst_name, dst_sb->st_mode))) && ! overwrite_ok (x, dst_name, dst_sb))); Executed by:
executed 572 times by 1 test: return (x->interactive == I_ALWAYS_NO || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty && ! writable_destination (dst_name, dst_sb->st_mode))) && ! overwrite_ok (x, dst_name, dst_sb))); Executed by:
| 572 | ||||||||||||||||||||||||||||||
2130 | || ((x->interactive == I_ASK_USER executed 572 times by 1 test: return (x->interactive == I_ALWAYS_NO || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty && ! writable_destination (dst_name, dst_sb->st_mode))) && ! overwrite_ok (x, dst_name, dst_sb))); Executed by:
| 572 | ||||||||||||||||||||||||||||||
2131 | || (x->interactive == I_UNSPECIFIED executed 572 times by 1 test: return (x->interactive == I_ALWAYS_NO || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty && ! writable_destination (dst_name, dst_sb->st_mode))) && ! overwrite_ok (x, dst_name, dst_sb))); Executed by:
| 572 | ||||||||||||||||||||||||||||||
2132 | && x->stdin_tty executed 572 times by 1 test: return (x->interactive == I_ALWAYS_NO || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty && ! writable_destination (dst_name, dst_sb->st_mode))) && ! overwrite_ok (x, dst_name, dst_sb))); Executed by:
| 572 | ||||||||||||||||||||||||||||||
2133 | && ! writable_destination (dst_name, dst_sb->st_mode))) executed 572 times by 1 test: return (x->interactive == I_ALWAYS_NO || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty && ! writable_destination (dst_name, dst_sb->st_mode))) && ! overwrite_ok (x, dst_name, dst_sb))); Executed by:
| 572 | ||||||||||||||||||||||||||||||
2134 | && ! overwrite_ok (x, dst_name, dst_sb))); executed 572 times by 1 test: return (x->interactive == I_ALWAYS_NO || ((x->interactive == I_ASK_USER || (x->interactive == I_UNSPECIFIED && x->stdin_tty && ! writable_destination (dst_name, dst_sb->st_mode))) && ! overwrite_ok (x, dst_name, dst_sb))); Executed by:
| 572 | ||||||||||||||||||||||||||||||
2135 | } | - | ||||||||||||||||||||||||||||||
2136 | - | |||||||||||||||||||||||||||||||
2137 | - | |||||||||||||||||||||||||||||||
2138 | - | |||||||||||||||||||||||||||||||
2139 | - | |||||||||||||||||||||||||||||||
2140 | static void | - | ||||||||||||||||||||||||||||||
2141 | emit_verbose (char const *src, char const *dst, char const *backup_dst_name) | - | ||||||||||||||||||||||||||||||
2142 | { | - | ||||||||||||||||||||||||||||||
2143 | printf ("%s -> %s", quotearg_n_style (0, shell_escape_always_quoting_style, src), quotearg_n_style (1, shell_escape_always_quoting_style, dst)); | - | ||||||||||||||||||||||||||||||
2144 | if (backup_dst_name
| 1-19 | ||||||||||||||||||||||||||||||
2145 | printf ( executed 1 time by 1 test: printf ( dcgettext (((void *)0), " (backup: %s)" , 5) , quotearg_style (shell_escape_always_quoting_style, backup_dst_name)); Executed by:
| 1 | ||||||||||||||||||||||||||||||
2146 | dcgettext (((void *)0), executed 1 time by 1 test: printf ( dcgettext (((void *)0), " (backup: %s)" , 5) , quotearg_style (shell_escape_always_quoting_style, backup_dst_name)); Executed by:
| 1 | ||||||||||||||||||||||||||||||
2147 | " (backup: %s)" executed 1 time by 1 test: printf ( dcgettext (((void *)0), " (backup: %s)" , 5) , quotearg_style (shell_escape_always_quoting_style, backup_dst_name)); Executed by:
| 1 | ||||||||||||||||||||||||||||||
2148 | , 5) executed 1 time by 1 test: printf ( dcgettext (((void *)0), " (backup: %s)" , 5) , quotearg_style (shell_escape_always_quoting_style, backup_dst_name)); Executed by:
| 1 | ||||||||||||||||||||||||||||||
2149 | , quotearg_style (shell_escape_always_quoting_style, backup_dst_name)); executed 1 time by 1 test: printf ( dcgettext (((void *)0), " (backup: %s)" , 5) , quotearg_style (shell_escape_always_quoting_style, backup_dst_name)); Executed by:
| 1 | ||||||||||||||||||||||||||||||
2150 | putchar_unlocked ('\n'); | - | ||||||||||||||||||||||||||||||
2151 | } executed 20 times by 3 tests: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
2152 | - | |||||||||||||||||||||||||||||||
2153 | - | |||||||||||||||||||||||||||||||
2154 | static void | - | ||||||||||||||||||||||||||||||
2155 | restore_default_fscreatecon_or_die (void) | - | ||||||||||||||||||||||||||||||
2156 | { | - | ||||||||||||||||||||||||||||||
2157 | if (setfscreatecon (
| 0 | ||||||||||||||||||||||||||||||
2158 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||
2159 | ) != 0
| 0 | ||||||||||||||||||||||||||||||
2160 | (( never executed: !!sizeof (struct { _Static_assert (((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2161 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2162 | , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2163 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2164 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2165 | (*__errno_location ()) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2166 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2167 | dcgettext (((void *)0), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2168 | "failed to restore the default file creation context" never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2169 | , 5) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2170 | ), (( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2171 | 0 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2172 | ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2173 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2174 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2175 | (*__errno_location ()) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2176 | , never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2177 | dcgettext (((void *)0), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2178 | "failed to restore the default file creation context" never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2179 | , 5) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2180 | ), (( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2181 | 0 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2182 | ) ? (void) 0 : __builtin_unreachable ())))) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2183 | ; never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to restore the default file creation context\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errn...ile creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to restore the default file creation context" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; | 0 | ||||||||||||||||||||||||||||||
2184 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2185 | - | |||||||||||||||||||||||||||||||
2186 | - | |||||||||||||||||||||||||||||||
2187 | - | |||||||||||||||||||||||||||||||
2188 | - | |||||||||||||||||||||||||||||||
2189 | - | |||||||||||||||||||||||||||||||
2190 | - | |||||||||||||||||||||||||||||||
2191 | - | |||||||||||||||||||||||||||||||
2192 | static | - | ||||||||||||||||||||||||||||||
2193 | _Bool | - | ||||||||||||||||||||||||||||||
2194 | - | |||||||||||||||||||||||||||||||
2195 | create_hard_link (char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
2196 | - | |||||||||||||||||||||||||||||||
2197 | _Bool | - | ||||||||||||||||||||||||||||||
2198 | replace, | - | ||||||||||||||||||||||||||||||
2199 | _Bool | - | ||||||||||||||||||||||||||||||
2200 | verbose, | - | ||||||||||||||||||||||||||||||
2201 | _Bool | - | ||||||||||||||||||||||||||||||
2202 | dereference) | - | ||||||||||||||||||||||||||||||
2203 | { | - | ||||||||||||||||||||||||||||||
2204 | int status = force_linkat ( | - | ||||||||||||||||||||||||||||||
2205 | -100 | - | ||||||||||||||||||||||||||||||
2206 | , src_name, | - | ||||||||||||||||||||||||||||||
2207 | -100 | - | ||||||||||||||||||||||||||||||
2208 | , dst_name, | - | ||||||||||||||||||||||||||||||
2209 | dereference ? | - | ||||||||||||||||||||||||||||||
2210 | 0x400 | - | ||||||||||||||||||||||||||||||
2211 | : 0, | - | ||||||||||||||||||||||||||||||
2212 | replace); | - | ||||||||||||||||||||||||||||||
2213 | if (status < 0
| 5-30051 | ||||||||||||||||||||||||||||||
2214 | { | - | ||||||||||||||||||||||||||||||
2215 | error (0, | - | ||||||||||||||||||||||||||||||
2216 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
2217 | , | - | ||||||||||||||||||||||||||||||
2218 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2219 | "cannot create hard link %s to %s" | - | ||||||||||||||||||||||||||||||
2220 | , 5) | - | ||||||||||||||||||||||||||||||
2221 | , | - | ||||||||||||||||||||||||||||||
2222 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name), quotearg_n_style (1, shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
2223 | return executed 5 times by 1 test: return 0 ; Executed by:
executed 5 times by 1 test: return 0 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
2224 | 0 executed 5 times by 1 test: return 0 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
2225 | ; executed 5 times by 1 test: return 0 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
2226 | } | - | ||||||||||||||||||||||||||||||
2227 | if (0 < status
| 0-30035 | ||||||||||||||||||||||||||||||
2228 | printf ( never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
2229 | dcgettext (((void *)0), never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
2230 | "removed %s\n" never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
2231 | , 5) never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
2232 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); never executed: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
2233 | return executed 30051 times by 2 tests: return 1 ; Executed by:
executed 30051 times by 2 tests: return 1 ; Executed by:
| 30051 | ||||||||||||||||||||||||||||||
2234 | 1 executed 30051 times by 2 tests: return 1 ; Executed by:
| 30051 | ||||||||||||||||||||||||||||||
2235 | ; executed 30051 times by 2 tests: return 1 ; Executed by:
| 30051 | ||||||||||||||||||||||||||||||
2236 | } | - | ||||||||||||||||||||||||||||||
2237 | - | |||||||||||||||||||||||||||||||
2238 | - | |||||||||||||||||||||||||||||||
2239 | - | |||||||||||||||||||||||||||||||
2240 | - | |||||||||||||||||||||||||||||||
2241 | static inline | - | ||||||||||||||||||||||||||||||
2242 | _Bool | - | ||||||||||||||||||||||||||||||
2243 | __attribute__ ((__pure__)) | - | ||||||||||||||||||||||||||||||
2244 | should_dereference (const struct cp_options *x, | - | ||||||||||||||||||||||||||||||
2245 | _Bool | - | ||||||||||||||||||||||||||||||
2246 | command_line_arg) | - | ||||||||||||||||||||||||||||||
2247 | { | - | ||||||||||||||||||||||||||||||
2248 | return executed 69216 times by 3 tests: x->dereference == DEREF_ALWAYSreturn x->dereference == DEREF_ALWAYS || (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS && command_line_arg); Executed by:
executed 69216 times by 3 tests: return x->dereference == DEREF_ALWAYS || (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS && command_line_arg); Executed by:
| 69216 | ||||||||||||||||||||||||||||||
2249 | || (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS executed 69216 times by 3 tests: return x->dereference == DEREF_ALWAYS || (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS && command_line_arg); Executed by:
| 69216 | ||||||||||||||||||||||||||||||
2250 | && command_line_arg); executed 69216 times by 3 tests: return x->dereference == DEREF_ALWAYS || (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS && command_line_arg); Executed by:
| 69216 | ||||||||||||||||||||||||||||||
2251 | } | - | ||||||||||||||||||||||||||||||
2252 | - | |||||||||||||||||||||||||||||||
2253 | - | |||||||||||||||||||||||||||||||
2254 | - | |||||||||||||||||||||||||||||||
2255 | static | - | ||||||||||||||||||||||||||||||
2256 | _Bool | - | ||||||||||||||||||||||||||||||
2257 | - | |||||||||||||||||||||||||||||||
2258 | source_is_dst_backup (char const *srcbase, struct stat const *src_st, | - | ||||||||||||||||||||||||||||||
2259 | char const *dst_name) | - | ||||||||||||||||||||||||||||||
2260 | { | - | ||||||||||||||||||||||||||||||
2261 | size_t srcbaselen = strlen (srcbase); | - | ||||||||||||||||||||||||||||||
2262 | char const *dstbase = last_component (dst_name); | - | ||||||||||||||||||||||||||||||
2263 | size_t dstbaselen = strlen (dstbase); | - | ||||||||||||||||||||||||||||||
2264 | size_t suffixlen = strlen (simple_backup_suffix); | - | ||||||||||||||||||||||||||||||
2265 | if (! (srcbaselen == dstbaselen + suffixlen
| 10-41 | ||||||||||||||||||||||||||||||
2266 | && memcmp (srcbase, dstbase, dstbaselen) == 0
| 2-8 | ||||||||||||||||||||||||||||||
2267 | && (
| 0-2 | ||||||||||||||||||||||||||||||
2268 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
| 0-2 | ||||||||||||||||||||||||||||||
2269 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2270 | ) && __builtin_constant_p (
| 0-2 | ||||||||||||||||||||||||||||||
2271 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2272 | ) && (__s1_len = __builtin_strlen (
| 0-2 | ||||||||||||||||||||||||||||||
2273 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2274 | ), __s2_len = __builtin_strlen (
| 0-2 | ||||||||||||||||||||||||||||||
2275 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2276 | ), (!((size_t)(const void *)((
| 0-2 | ||||||||||||||||||||||||||||||
2277 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2278 | ) + 1) - (size_t)(const void *)(
| 0-2 | ||||||||||||||||||||||||||||||
2279 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2280 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
| 0-2 | ||||||||||||||||||||||||||||||
2281 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2282 | ) + 1) - (size_t)(const void *)(
| 0-2 | ||||||||||||||||||||||||||||||
2283 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2284 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
| 0-2 | ||||||||||||||||||||||||||||||
2285 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2286 | ,
| 0-2 | ||||||||||||||||||||||||||||||
2287 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2288 | ) : (__builtin_constant_p (
| 0-2 | ||||||||||||||||||||||||||||||
2289 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2290 | ) && ((size_t)(const void *)((
| 0-2 | ||||||||||||||||||||||||||||||
2291 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2292 | ) + 1) - (size_t)(const void *)(
| 0-2 | ||||||||||||||||||||||||||||||
2293 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2294 | ) == 1) && (__s1_len = __builtin_strlen (
| 0-2 | ||||||||||||||||||||||||||||||
2295 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2296 | ), __s1_len < 4) ? (__builtin_constant_p (
| 0-2 | ||||||||||||||||||||||||||||||
2297 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2298 | ) && ((size_t)(const void *)((
| 0-2 | ||||||||||||||||||||||||||||||
2299 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2300 | ) + 1) - (size_t)(const void *)(
| 0-2 | ||||||||||||||||||||||||||||||
2301 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2302 | ) == 1) ? __builtin_strcmp (
| 0-2 | ||||||||||||||||||||||||||||||
2303 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2304 | ,
| 0-2 | ||||||||||||||||||||||||||||||
2305 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2306 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0-2 | ||||||||||||||||||||||||||||||
2307 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2308 | ); int __result = (((const unsigned char *) (const char *) (
| 0-2 | ||||||||||||||||||||||||||||||
2309 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2310 | ))[0] - __s2[0]); if (__s1_len > 0
| 0-2 | ||||||||||||||||||||||||||||||
2311 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2312 | ))[1] - __s2[1]); if (__s1_len > 1
| 0-2 | ||||||||||||||||||||||||||||||
2313 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2314 | ))[2] - __s2[2]); if (__s1_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( srcbase + dstbaselen ))[3] - __s2[3]);
| 0-2 | ||||||||||||||||||||||||||||||
2315 | srcbase + dstbaselen
never executed: __result = (((const unsigned char *) (const char *) ( srcbase + dstbaselen ))[3] - __s2[3]); | 0-2 | ||||||||||||||||||||||||||||||
2316 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( srcbase + dstbaselen ))[3] - __s2[3]); never executed: }end of block never executed: __result; }))) : (__builtin_constant_p (end of block
| 0-2 | ||||||||||||||||||||||||||||||
2317 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2318 | ) && ((size_t)(const void *)((
| 0-2 | ||||||||||||||||||||||||||||||
2319 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2320 | ) + 1) - (size_t)(const void *)(
| 0-2 | ||||||||||||||||||||||||||||||
2321 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2322 | ) == 1) && (__s2_len = __builtin_strlen (
| 0-2 | ||||||||||||||||||||||||||||||
2323 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2324 | ), __s2_len < 4) ? (__builtin_constant_p (
| 0-2 | ||||||||||||||||||||||||||||||
2325 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2326 | ) && ((size_t)(const void *)((
| 0-2 | ||||||||||||||||||||||||||||||
2327 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2328 | ) + 1) - (size_t)(const void *)(
| 0-2 | ||||||||||||||||||||||||||||||
2329 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2330 | ) == 1) ? __builtin_strcmp (
| 0-2 | ||||||||||||||||||||||||||||||
2331 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2332 | ,
| 0-2 | ||||||||||||||||||||||||||||||
2333 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2334 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0-2 | ||||||||||||||||||||||||||||||
2335 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2336 | ); int __result = (((const unsigned char *) (const char *) (
| 0-2 | ||||||||||||||||||||||||||||||
2337 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2338 | ))[0] - __s2[0]); if (__s2_len > 0
| 0-2 | ||||||||||||||||||||||||||||||
2339 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2340 | ))[1] - __s2[1]); if (__s2_len > 1
| 0-2 | ||||||||||||||||||||||||||||||
2341 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2342 | ))[2] - __s2[2]); if (__s2_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( simple_backup_suffix ))[3] - __s2[3]);
| 0-2 | ||||||||||||||||||||||||||||||
2343 | simple_backup_suffix
never executed: __result = (((const unsigned char *) (const char *) ( simple_backup_suffix ))[3] - __s2[3]); | 0-2 | ||||||||||||||||||||||||||||||
2344 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( simple_backup_suffix ))[3] - __s2[3]); never executed: }end of block never executed: __result; }))) : __builtin_strcmp (end of block
| 0-2 | ||||||||||||||||||||||||||||||
2345 | srcbase + dstbaselen
| 0-2 | ||||||||||||||||||||||||||||||
2346 | ,
| 0-2 | ||||||||||||||||||||||||||||||
2347 | simple_backup_suffix
| 0-2 | ||||||||||||||||||||||||||||||
2348 | )))); })
| 0-2 | ||||||||||||||||||||||||||||||
2349 | == 0)
| 0-2 | ||||||||||||||||||||||||||||||
2350 | return executed 49 times by 3 tests: return 0 ; Executed by:
executed 49 times by 3 tests: return 0 ; Executed by:
| 49 | ||||||||||||||||||||||||||||||
2351 | 0 executed 49 times by 3 tests: return 0 ; Executed by:
| 49 | ||||||||||||||||||||||||||||||
2352 | ; executed 49 times by 3 tests: return 0 ; Executed by:
| 49 | ||||||||||||||||||||||||||||||
2353 | size_t dstlen = strlen (dst_name); | - | ||||||||||||||||||||||||||||||
2354 | char *dst_back = xmalloc (dstlen + suffixlen + 1); | - | ||||||||||||||||||||||||||||||
2355 | strcpy (mempcpy (dst_back, dst_name, dstlen), simple_backup_suffix); | - | ||||||||||||||||||||||||||||||
2356 | struct stat dst_back_sb; | - | ||||||||||||||||||||||||||||||
2357 | int dst_back_status = stat (dst_back, &dst_back_sb); | - | ||||||||||||||||||||||||||||||
2358 | free (dst_back); | - | ||||||||||||||||||||||||||||||
2359 | return executed 2 times by 2 tests: dst_back_status == 0 && ((*src_st).st_ino == (dst_back_sb).st_ino && (*src_st).st_dev == (dst_back_sb).st_dev);return dst_back_status == 0 && ((*src_st).st_ino == (dst_back_sb).st_ino && (*src_st).st_dev == (dst_back_sb).st_dev); Executed by:
executed 2 times by 2 tests: return dst_back_status == 0 && ((*src_st).st_ino == (dst_back_sb).st_ino && (*src_st).st_dev == (dst_back_sb).st_dev); Executed by:
| 2 | ||||||||||||||||||||||||||||||
2360 | } | - | ||||||||||||||||||||||||||||||
2361 | static | - | ||||||||||||||||||||||||||||||
2362 | _Bool | - | ||||||||||||||||||||||||||||||
2363 | - | |||||||||||||||||||||||||||||||
2364 | copy_internal (char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
2365 | - | |||||||||||||||||||||||||||||||
2366 | _Bool | - | ||||||||||||||||||||||||||||||
2367 | new_dst, | - | ||||||||||||||||||||||||||||||
2368 | struct stat const *parent, | - | ||||||||||||||||||||||||||||||
2369 | struct dir_list *ancestors, | - | ||||||||||||||||||||||||||||||
2370 | const struct cp_options *x, | - | ||||||||||||||||||||||||||||||
2371 | - | |||||||||||||||||||||||||||||||
2372 | _Bool | - | ||||||||||||||||||||||||||||||
2373 | command_line_arg, | - | ||||||||||||||||||||||||||||||
2374 | - | |||||||||||||||||||||||||||||||
2375 | _Bool | - | ||||||||||||||||||||||||||||||
2376 | *first_dir_created_per_command_line_arg, | - | ||||||||||||||||||||||||||||||
2377 | - | |||||||||||||||||||||||||||||||
2378 | _Bool | - | ||||||||||||||||||||||||||||||
2379 | *copy_into_self, | - | ||||||||||||||||||||||||||||||
2380 | - | |||||||||||||||||||||||||||||||
2381 | _Bool | - | ||||||||||||||||||||||||||||||
2382 | *rename_succeeded) | - | ||||||||||||||||||||||||||||||
2383 | { | - | ||||||||||||||||||||||||||||||
2384 | struct stat src_sb; | - | ||||||||||||||||||||||||||||||
2385 | struct stat dst_sb; | - | ||||||||||||||||||||||||||||||
2386 | mode_t src_mode ; | - | ||||||||||||||||||||||||||||||
2387 | mode_t dst_mode ; | - | ||||||||||||||||||||||||||||||
2388 | mode_t dst_mode_bits; | - | ||||||||||||||||||||||||||||||
2389 | mode_t omitted_permissions; | - | ||||||||||||||||||||||||||||||
2390 | - | |||||||||||||||||||||||||||||||
2391 | _Bool | - | ||||||||||||||||||||||||||||||
2392 | restore_dst_mode = | - | ||||||||||||||||||||||||||||||
2393 | 0 | - | ||||||||||||||||||||||||||||||
2394 | ; | - | ||||||||||||||||||||||||||||||
2395 | char *earlier_file = | - | ||||||||||||||||||||||||||||||
2396 | ((void *)0) | - | ||||||||||||||||||||||||||||||
2397 | ; | - | ||||||||||||||||||||||||||||||
2398 | char *dst_backup = | - | ||||||||||||||||||||||||||||||
2399 | ((void *)0) | - | ||||||||||||||||||||||||||||||
2400 | ; | - | ||||||||||||||||||||||||||||||
2401 | - | |||||||||||||||||||||||||||||||
2402 | _Bool | - | ||||||||||||||||||||||||||||||
2403 | delayed_ok; | - | ||||||||||||||||||||||||||||||
2404 | - | |||||||||||||||||||||||||||||||
2405 | _Bool | - | ||||||||||||||||||||||||||||||
2406 | copied_as_regular = | - | ||||||||||||||||||||||||||||||
2407 | 0 | - | ||||||||||||||||||||||||||||||
2408 | ; | - | ||||||||||||||||||||||||||||||
2409 | - | |||||||||||||||||||||||||||||||
2410 | _Bool | - | ||||||||||||||||||||||||||||||
2411 | dest_is_symlink = | - | ||||||||||||||||||||||||||||||
2412 | 0 | - | ||||||||||||||||||||||||||||||
2413 | ; | - | ||||||||||||||||||||||||||||||
2414 | - | |||||||||||||||||||||||||||||||
2415 | _Bool | - | ||||||||||||||||||||||||||||||
2416 | have_dst_lstat = | - | ||||||||||||||||||||||||||||||
2417 | 0 | - | ||||||||||||||||||||||||||||||
2418 | ; | - | ||||||||||||||||||||||||||||||
2419 | - | |||||||||||||||||||||||||||||||
2420 | *copy_into_self = | - | ||||||||||||||||||||||||||||||
2421 | 0 | - | ||||||||||||||||||||||||||||||
2422 | ; | - | ||||||||||||||||||||||||||||||
2423 | - | |||||||||||||||||||||||||||||||
2424 | int rename_errno = x->rename_errno; | - | ||||||||||||||||||||||||||||||
2425 | if (x->move_mode
| 8458-60773 | ||||||||||||||||||||||||||||||
2426 | { | - | ||||||||||||||||||||||||||||||
2427 | if (rename_errno < 0
| 584-7874 | ||||||||||||||||||||||||||||||
2428 | rename_errno = (renameat2 (
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2429 | -100
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2430 | , src_name,
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2431 | -100
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2432 | , dst_name,
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2433 |
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2434 | (1 << 0)
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2435 | )
executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 12-7874 | ||||||||||||||||||||||||||||||
2436 | ? executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 7874 | ||||||||||||||||||||||||||||||
2437 | (*__errno_location ()) executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 7874 | ||||||||||||||||||||||||||||||
2438 | : 0); executed 7874 times by 1 test: rename_errno = (renameat2 ( -100 , src_name, -100 , dst_name, (1 << 0) ) ? (*__errno_location ()) : 0); Executed by:
| 7874 | ||||||||||||||||||||||||||||||
2439 | new_dst = rename_errno == 0; | - | ||||||||||||||||||||||||||||||
2440 | if (rename_succeeded
| 3919-4539 | ||||||||||||||||||||||||||||||
2441 | * executed 4539 times by 1 test: rename_succeeded = new_dst;*rename_succeeded = new_dst; Executed by:
executed 4539 times by 1 test: *rename_succeeded = new_dst; Executed by:
| 4539 | ||||||||||||||||||||||||||||||
2442 | } executed 8458 times by 1 test: end of block Executed by:
| 8458 | ||||||||||||||||||||||||||||||
2443 | - | |||||||||||||||||||||||||||||||
2444 | if (rename_errno == 0
| 28-69203 | ||||||||||||||||||||||||||||||
2445 | ? !x->last_file
| 28-69203 | ||||||||||||||||||||||||||||||
2446 | : rename_errno !=
| 28-69203 | ||||||||||||||||||||||||||||||
2447 | 17
| 28-69203 | ||||||||||||||||||||||||||||||
2448 | || x->interactive != I_ALWAYS_NO
| 3-69203 | ||||||||||||||||||||||||||||||
2449 | { | - | ||||||||||||||||||||||||||||||
2450 | char const *name = rename_errno == 0
| 7-69196 | ||||||||||||||||||||||||||||||
2451 | if (((
| 9-69194 | ||||||||||||||||||||||||||||||
2452 | { | - | ||||||||||||||||||||||||||||||
2453 | error (0, | - | ||||||||||||||||||||||||||||||
2454 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
2455 | , | - | ||||||||||||||||||||||||||||||
2456 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2457 | "cannot stat %s" | - | ||||||||||||||||||||||||||||||
2458 | , 5) | - | ||||||||||||||||||||||||||||||
2459 | , quotearg_style (shell_escape_always_quoting_style, name)); | - | ||||||||||||||||||||||||||||||
2460 | return executed 9 times by 2 tests: return 0 ; Executed by:
executed 9 times by 2 tests: return 0 ; Executed by:
| 9 | ||||||||||||||||||||||||||||||
2461 | 0 executed 9 times by 2 tests: return 0 ; Executed by:
| 9 | ||||||||||||||||||||||||||||||
2462 | ; executed 9 times by 2 tests: return 0 ; Executed by:
| 9 | ||||||||||||||||||||||||||||||
2463 | } | - | ||||||||||||||||||||||||||||||
2464 | - | |||||||||||||||||||||||||||||||
2465 | src_mode = src_sb.st_mode; | - | ||||||||||||||||||||||||||||||
2466 | - | |||||||||||||||||||||||||||||||
2467 | if ( | - | ||||||||||||||||||||||||||||||
2468 | ((((
| 34000-35194 | ||||||||||||||||||||||||||||||
2469 | src_mode
| 34000-35194 | ||||||||||||||||||||||||||||||
2470 | )) & 0170000) == (0040000))
| 34000-35194 | ||||||||||||||||||||||||||||||
2471 | && !x->recursive
| 4-33996 | ||||||||||||||||||||||||||||||
2472 | { | - | ||||||||||||||||||||||||||||||
2473 | error (0, 0, ! x->install_mode | - | ||||||||||||||||||||||||||||||
2474 | ? | - | ||||||||||||||||||||||||||||||
2475 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2476 | "-r not specified; omitting directory %s" | - | ||||||||||||||||||||||||||||||
2477 | , 5) | - | ||||||||||||||||||||||||||||||
2478 | - | |||||||||||||||||||||||||||||||
2479 | : | - | ||||||||||||||||||||||||||||||
2480 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2481 | "omitting directory %s" | - | ||||||||||||||||||||||||||||||
2482 | , 5) | - | ||||||||||||||||||||||||||||||
2483 | , | - | ||||||||||||||||||||||||||||||
2484 | quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
2485 | return executed 4 times by 2 tests: return 0 ; Executed by:
executed 4 times by 2 tests: return 0 ; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2486 | 0 executed 4 times by 2 tests: return 0 ; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2487 | ; executed 4 times by 2 tests: return 0 ; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2488 | } | - | ||||||||||||||||||||||||||||||
2489 | } executed 69190 times by 3 tests: end of block Executed by:
| 69190 | ||||||||||||||||||||||||||||||
2490 | - | |||||||||||||||||||||||||||||||
2491 | - | |||||||||||||||||||||||||||||||
2492 | - | |||||||||||||||||||||||||||||||
2493 | - | |||||||||||||||||||||||||||||||
2494 | - | |||||||||||||||||||||||||||||||
2495 | if (command_line_arg
| 40-63958 | ||||||||||||||||||||||||||||||
2496 | { | - | ||||||||||||||||||||||||||||||
2497 | if ( !
| 11-29 | ||||||||||||||||||||||||||||||
2498 | ((((
| 11-29 | ||||||||||||||||||||||||||||||
2499 | src_sb.st_mode
| 11-29 | ||||||||||||||||||||||||||||||
2500 | )) & 0170000) == (0040000))
| 11-29 | ||||||||||||||||||||||||||||||
2501 | - | |||||||||||||||||||||||||||||||
2502 | && x->backup_type == no_backups
| 6-23 | ||||||||||||||||||||||||||||||
2503 | && seen_file (x->src_info, src_name, &src_sb)
| 2-21 | ||||||||||||||||||||||||||||||
2504 | { | - | ||||||||||||||||||||||||||||||
2505 | error (0, 0, | - | ||||||||||||||||||||||||||||||
2506 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2507 | "warning: source file %s specified more than once" | - | ||||||||||||||||||||||||||||||
2508 | , 5) | - | ||||||||||||||||||||||||||||||
2509 | , | - | ||||||||||||||||||||||||||||||
2510 | quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
2511 | return executed 2 times by 1 test: return 1 ; Executed by:
executed 2 times by 1 test: return 1 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2512 | 1 executed 2 times by 1 test: return 1 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2513 | ; executed 2 times by 1 test: return 1 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2514 | } | - | ||||||||||||||||||||||||||||||
2515 | - | |||||||||||||||||||||||||||||||
2516 | record_file (x->src_info, src_name, &src_sb); | - | ||||||||||||||||||||||||||||||
2517 | } executed 38 times by 1 test: end of block Executed by:
| 38 | ||||||||||||||||||||||||||||||
2518 | - | |||||||||||||||||||||||||||||||
2519 | - | |||||||||||||||||||||||||||||||
2520 | _Bool | - | ||||||||||||||||||||||||||||||
2521 | dereference = should_dereference (x, command_line_arg); | - | ||||||||||||||||||||||||||||||
2522 | - | |||||||||||||||||||||||||||||||
2523 | if (!new_dst
| 9157-60059 | ||||||||||||||||||||||||||||||
2524 | { | - | ||||||||||||||||||||||||||||||
2525 | if (! (rename_errno ==
| 568-8589 | ||||||||||||||||||||||||||||||
2526 | 17
| 568-8589 | ||||||||||||||||||||||||||||||
2527 | && x->interactive == I_ALWAYS_NO
| 3-565 | ||||||||||||||||||||||||||||||
2528 | { | - | ||||||||||||||||||||||||||||||
2529 | - | |||||||||||||||||||||||||||||||
2530 | - | |||||||||||||||||||||||||||||||
2531 | - | |||||||||||||||||||||||||||||||
2532 | - | |||||||||||||||||||||||||||||||
2533 | - | |||||||||||||||||||||||||||||||
2534 | - | |||||||||||||||||||||||||||||||
2535 | - | |||||||||||||||||||||||||||||||
2536 | _Bool | - | ||||||||||||||||||||||||||||||
2537 | use_lstat | - | ||||||||||||||||||||||||||||||
2538 | = ((!
| 4034-5120 | ||||||||||||||||||||||||||||||
2539 | ((((
| 4034-5120 | ||||||||||||||||||||||||||||||
2540 | src_mode
| 4034-5120 | ||||||||||||||||||||||||||||||
2541 | )) & 0170000) == (0100000))
| 4034-5120 | ||||||||||||||||||||||||||||||
2542 | - | |||||||||||||||||||||||||||||||
2543 | && (! x->copy_as_regular
| 34-4000 | ||||||||||||||||||||||||||||||
2544 | || | - | ||||||||||||||||||||||||||||||
2545 | ((((
| 2-32 | ||||||||||||||||||||||||||||||
2546 | src_mode
| 2-32 | ||||||||||||||||||||||||||||||
2547 | )) & 0170000) == (0040000))
| 2-32 | ||||||||||||||||||||||||||||||
2548 | || | - | ||||||||||||||||||||||||||||||
2549 | ((((
| 2-30 | ||||||||||||||||||||||||||||||
2550 | src_mode
| 2-30 | ||||||||||||||||||||||||||||||
2551 | )) & 0170000) == (0120000))
| 2-30 | ||||||||||||||||||||||||||||||
2552 | )) | - | ||||||||||||||||||||||||||||||
2553 | || x->move_mode
| 1-4477 | ||||||||||||||||||||||||||||||
2554 | || x->backup_type != no_backups
| 65-534 | ||||||||||||||||||||||||||||||
2555 | || x->unlink_dest_before_opening
| 33-501 | ||||||||||||||||||||||||||||||
2556 | int fstatat_flags = use_lstat
| 501-8653 | ||||||||||||||||||||||||||||||
2557 | 0x100 | - | ||||||||||||||||||||||||||||||
2558 | : 0; | - | ||||||||||||||||||||||||||||||
2559 | if (fstatat (
| 885-8269 | ||||||||||||||||||||||||||||||
2560 | -100
| 885-8269 | ||||||||||||||||||||||||||||||
2561 | , dst_name, &dst_sb, fstatat_flags) == 0
| 885-8269 | ||||||||||||||||||||||||||||||
2562 | { | - | ||||||||||||||||||||||||||||||
2563 | have_dst_lstat = use_lstat; | - | ||||||||||||||||||||||||||||||
2564 | rename_errno = | - | ||||||||||||||||||||||||||||||
2565 | 17 | - | ||||||||||||||||||||||||||||||
2566 | ; | - | ||||||||||||||||||||||||||||||
2567 | } executed 885 times by 3 tests: end of block Executed by:
| 885 | ||||||||||||||||||||||||||||||
2568 | else | - | ||||||||||||||||||||||||||||||
2569 | { | - | ||||||||||||||||||||||||||||||
2570 | if ( | - | ||||||||||||||||||||||||||||||
2571 | (*
| 0-8269 | ||||||||||||||||||||||||||||||
2572 | !=
| 0-8269 | ||||||||||||||||||||||||||||||
2573 | 2
| 0-8269 | ||||||||||||||||||||||||||||||
2574 | ) | - | ||||||||||||||||||||||||||||||
2575 | { | - | ||||||||||||||||||||||||||||||
2576 | error (0, | - | ||||||||||||||||||||||||||||||
2577 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
2578 | , | - | ||||||||||||||||||||||||||||||
2579 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2580 | "cannot stat %s" | - | ||||||||||||||||||||||||||||||
2581 | , 5) | - | ||||||||||||||||||||||||||||||
2582 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2583 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2584 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2585 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2586 | } | - | ||||||||||||||||||||||||||||||
2587 | new_dst = | - | ||||||||||||||||||||||||||||||
2588 | 1 | - | ||||||||||||||||||||||||||||||
2589 | ; | - | ||||||||||||||||||||||||||||||
2590 | } executed 8269 times by 3 tests: end of block Executed by:
| 8269 | ||||||||||||||||||||||||||||||
2591 | } | - | ||||||||||||||||||||||||||||||
2592 | - | |||||||||||||||||||||||||||||||
2593 | if (rename_errno ==
| 888-8269 | ||||||||||||||||||||||||||||||
2594 | 17
| 888-8269 | ||||||||||||||||||||||||||||||
2595 | ) | - | ||||||||||||||||||||||||||||||
2596 | { | - | ||||||||||||||||||||||||||||||
2597 | - | |||||||||||||||||||||||||||||||
2598 | _Bool | - | ||||||||||||||||||||||||||||||
2599 | return_now = | - | ||||||||||||||||||||||||||||||
2600 | 0 | - | ||||||||||||||||||||||||||||||
2601 | ; | - | ||||||||||||||||||||||||||||||
2602 | - | |||||||||||||||||||||||||||||||
2603 | if (x->interactive != I_ALWAYS_NO
| 6-882 | ||||||||||||||||||||||||||||||
2604 | && ! same_file_ok (src_name, &src_sb, dst_name, &dst_sb,
| 55-827 | ||||||||||||||||||||||||||||||
2605 | x, &return_now)
| 55-827 | ||||||||||||||||||||||||||||||
2606 | { | - | ||||||||||||||||||||||||||||||
2607 | error (0, 0, | - | ||||||||||||||||||||||||||||||
2608 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2609 | "%s and %s are the same file" | - | ||||||||||||||||||||||||||||||
2610 | , 5) | - | ||||||||||||||||||||||||||||||
2611 | , | - | ||||||||||||||||||||||||||||||
2612 | quotearg_n_style (0, shell_escape_always_quoting_style, src_name), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2613 | return executed 55 times by 2 tests: return 0 ; Executed by:
executed 55 times by 2 tests: return 0 ; Executed by:
| 55 | ||||||||||||||||||||||||||||||
2614 | 0 executed 55 times by 2 tests: return 0 ; Executed by:
| 55 | ||||||||||||||||||||||||||||||
2615 | ; executed 55 times by 2 tests: return 0 ; Executed by:
| 55 | ||||||||||||||||||||||||||||||
2616 | } | - | ||||||||||||||||||||||||||||||
2617 | - | |||||||||||||||||||||||||||||||
2618 | if (x->update
| 2-815 | ||||||||||||||||||||||||||||||
2619 | ((((
| 2-16 | ||||||||||||||||||||||||||||||
2620 | src_mode
| 2-16 | ||||||||||||||||||||||||||||||
2621 | )) & 0170000) == (0040000))
| 2-16 | ||||||||||||||||||||||||||||||
2622 | ) | - | ||||||||||||||||||||||||||||||
2623 | { | - | ||||||||||||||||||||||||||||||
2624 | - | |||||||||||||||||||||||||||||||
2625 | - | |||||||||||||||||||||||||||||||
2626 | - | |||||||||||||||||||||||||||||||
2627 | - | |||||||||||||||||||||||||||||||
2628 | int options = ((x->preserve_timestamps
| 5-11 | ||||||||||||||||||||||||||||||
2629 | && ! (x->move_mode
| 3-8 | ||||||||||||||||||||||||||||||
2630 | && dst_sb.st_dev == src_sb.st_dev
| 0-3 | ||||||||||||||||||||||||||||||
2631 | ? UTIMECMP_TRUNCATE_SOURCE | - | ||||||||||||||||||||||||||||||
2632 | : 0); | - | ||||||||||||||||||||||||||||||
2633 | - | |||||||||||||||||||||||||||||||
2634 | if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options)
| 4-12 | ||||||||||||||||||||||||||||||
2635 | { | - | ||||||||||||||||||||||||||||||
2636 | - | |||||||||||||||||||||||||||||||
2637 | - | |||||||||||||||||||||||||||||||
2638 | - | |||||||||||||||||||||||||||||||
2639 | - | |||||||||||||||||||||||||||||||
2640 | if (rename_succeeded
| 2-10 | ||||||||||||||||||||||||||||||
2641 | * executed 2 times by 1 test: rename_succeeded = *rename_succeeded = 1 ; Executed by:
executed 2 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2642 | 1 executed 2 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2643 | ; executed 2 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2644 | - | |||||||||||||||||||||||||||||||
2645 | - | |||||||||||||||||||||||||||||||
2646 | - | |||||||||||||||||||||||||||||||
2647 | - | |||||||||||||||||||||||||||||||
2648 | - | |||||||||||||||||||||||||||||||
2649 | - | |||||||||||||||||||||||||||||||
2650 | earlier_file = remember_copied (dst_name, src_sb.st_ino, | - | ||||||||||||||||||||||||||||||
2651 | src_sb.st_dev); | - | ||||||||||||||||||||||||||||||
2652 | if (earlier_file
| 5-7 | ||||||||||||||||||||||||||||||
2653 | { | - | ||||||||||||||||||||||||||||||
2654 | - | |||||||||||||||||||||||||||||||
2655 | - | |||||||||||||||||||||||||||||||
2656 | if (! create_hard_link (earlier_file, dst_name,
| 0-5 | ||||||||||||||||||||||||||||||
2657 | 1
| 0-5 | ||||||||||||||||||||||||||||||
2658 | ,
| 0-5 | ||||||||||||||||||||||||||||||
2659 | x->verbose, dereference)
| 0-5 | ||||||||||||||||||||||||||||||
2660 | { | - | ||||||||||||||||||||||||||||||
2661 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
2662 | } | - | ||||||||||||||||||||||||||||||
2663 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||
2664 | - | |||||||||||||||||||||||||||||||
2665 | return executed 12 times by 2 tests: return 1 ; Executed by:
executed 12 times by 2 tests: return 1 ; Executed by:
| 12 | ||||||||||||||||||||||||||||||
2666 | 1 executed 12 times by 2 tests: return 1 ; Executed by:
| 12 | ||||||||||||||||||||||||||||||
2667 | ; executed 12 times by 2 tests: return 1 ; Executed by:
| 12 | ||||||||||||||||||||||||||||||
2668 | } | - | ||||||||||||||||||||||||||||||
2669 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
2670 | if (x->move_mode
| 249-572 | ||||||||||||||||||||||||||||||
2671 | { | - | ||||||||||||||||||||||||||||||
2672 | if (abandon_move (x, dst_name, &dst_sb)
| 6-566 | ||||||||||||||||||||||||||||||
2673 | { | - | ||||||||||||||||||||||||||||||
2674 | - | |||||||||||||||||||||||||||||||
2675 | - | |||||||||||||||||||||||||||||||
2676 | if (rename_succeeded
| 0-6 | ||||||||||||||||||||||||||||||
2677 | * executed 6 times by 1 test: rename_succeeded = *rename_succeeded = 1 ; Executed by:
executed 6 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2678 | 1 executed 6 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2679 | ; executed 6 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2680 | return executed 6 times by 1 test: return 1 ; Executed by:
executed 6 times by 1 test: return 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2681 | 1 executed 6 times by 1 test: return 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2682 | ; executed 6 times by 1 test: return 1 ; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2683 | } | - | ||||||||||||||||||||||||||||||
2684 | } executed 566 times by 1 test: end of block Executed by:
| 566 | ||||||||||||||||||||||||||||||
2685 | else | - | ||||||||||||||||||||||||||||||
2686 | { | - | ||||||||||||||||||||||||||||||
2687 | if (!
| 18-231 | ||||||||||||||||||||||||||||||
2688 | ((((
| 18-231 | ||||||||||||||||||||||||||||||
2689 | src_mode
| 18-231 | ||||||||||||||||||||||||||||||
2690 | )) & 0170000) == (0040000))
| 18-231 | ||||||||||||||||||||||||||||||
2691 | - | |||||||||||||||||||||||||||||||
2692 | && (x->interactive == I_ALWAYS_NO
| 3-228 | ||||||||||||||||||||||||||||||
2693 | || (x->interactive == I_ASK_USER
| 7-221 | ||||||||||||||||||||||||||||||
2694 | && ! overwrite_ok (x, dst_name, &dst_sb)
| 2-5 | ||||||||||||||||||||||||||||||
2695 | return executed 5 times by 1 test: return 1 ; Executed by:
executed 5 times by 1 test: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
2696 | 1 executed 5 times by 1 test: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
2697 | ; executed 5 times by 1 test: return 1 ; Executed by:
| 5 | ||||||||||||||||||||||||||||||
2698 | } executed 244 times by 2 tests: end of block Executed by:
| 244 | ||||||||||||||||||||||||||||||
2699 | - | |||||||||||||||||||||||||||||||
2700 | if (return_now
| 26-784 | ||||||||||||||||||||||||||||||
2701 | return executed 26 times by 1 test: return 1 ; Executed by:
executed 26 times by 1 test: return 1 ; Executed by:
| 26 | ||||||||||||||||||||||||||||||
2702 | 1 executed 26 times by 1 test: return 1 ; Executed by:
| 26 | ||||||||||||||||||||||||||||||
2703 | ; executed 26 times by 1 test: return 1 ; Executed by:
| 26 | ||||||||||||||||||||||||||||||
2704 | - | |||||||||||||||||||||||||||||||
2705 | if (!
| 27-757 | ||||||||||||||||||||||||||||||
2706 | ((((
| 27-757 | ||||||||||||||||||||||||||||||
2707 | dst_sb.st_mode
| 27-757 | ||||||||||||||||||||||||||||||
2708 | )) & 0170000) == (0040000))
| 27-757 | ||||||||||||||||||||||||||||||
2709 | ) | - | ||||||||||||||||||||||||||||||
2710 | { | - | ||||||||||||||||||||||||||||||
2711 | if ( | - | ||||||||||||||||||||||||||||||
2712 | ((((
| 3-754 | ||||||||||||||||||||||||||||||
2713 | src_mode
| 3-754 | ||||||||||||||||||||||||||||||
2714 | )) & 0170000) == (0040000))
| 3-754 | ||||||||||||||||||||||||||||||
2715 | ) | - | ||||||||||||||||||||||||||||||
2716 | { | - | ||||||||||||||||||||||||||||||
2717 | if (x->move_mode
| 0-2 | ||||||||||||||||||||||||||||||
2718 | { | - | ||||||||||||||||||||||||||||||
2719 | - | |||||||||||||||||||||||||||||||
2720 | - | |||||||||||||||||||||||||||||||
2721 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2722 | else | - | ||||||||||||||||||||||||||||||
2723 | { | - | ||||||||||||||||||||||||||||||
2724 | error (0, 0, | - | ||||||||||||||||||||||||||||||
2725 | - | |||||||||||||||||||||||||||||||
2726 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2727 | "cannot overwrite non-directory %s with directory %s" | - | ||||||||||||||||||||||||||||||
2728 | , 5) | - | ||||||||||||||||||||||||||||||
2729 | , | - | ||||||||||||||||||||||||||||||
2730 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name), quotearg_n_style (1, shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
2731 | return executed 3 times by 2 tests: return 0 ; Executed by:
executed 3 times by 2 tests: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2732 | 0 executed 3 times by 2 tests: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2733 | ; executed 3 times by 2 tests: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2734 | } | - | ||||||||||||||||||||||||||||||
2735 | } | - | ||||||||||||||||||||||||||||||
2736 | if (command_line_arg
| 2-752 | ||||||||||||||||||||||||||||||
2737 | && x->backup_type != numbered_backups
| 44-708 | ||||||||||||||||||||||||||||||
2738 | && seen_file (x->dest_info, dst_name, &dst_sb)
| 4-704 | ||||||||||||||||||||||||||||||
2739 | { | - | ||||||||||||||||||||||||||||||
2740 | error (0, 0, | - | ||||||||||||||||||||||||||||||
2741 | - | |||||||||||||||||||||||||||||||
2742 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2743 | "will not overwrite just-created %s with %s" | - | ||||||||||||||||||||||||||||||
2744 | , 5) | - | ||||||||||||||||||||||||||||||
2745 | , | - | ||||||||||||||||||||||||||||||
2746 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name), quotearg_n_style (1, shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
2747 | return executed 4 times by 2 tests: return 0 ; Executed by:
executed 4 times by 2 tests: return 0 ; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2748 | 0 executed 4 times by 2 tests: return 0 ; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2749 | ; executed 4 times by 2 tests: return 0 ; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2750 | } | - | ||||||||||||||||||||||||||||||
2751 | } executed 750 times by 3 tests: end of block Executed by:
| 750 | ||||||||||||||||||||||||||||||
2752 | - | |||||||||||||||||||||||||||||||
2753 | if (!
| 24-753 | ||||||||||||||||||||||||||||||
2754 | ((((
| 24-753 | ||||||||||||||||||||||||||||||
2755 | src_mode
| 24-753 | ||||||||||||||||||||||||||||||
2756 | )) & 0170000) == (0040000))
| 24-753 | ||||||||||||||||||||||||||||||
2757 | ) | - | ||||||||||||||||||||||||||||||
2758 | { | - | ||||||||||||||||||||||||||||||
2759 | if ( | - | ||||||||||||||||||||||||||||||
2760 | ((((
| 3-750 | ||||||||||||||||||||||||||||||
2761 | dst_sb.st_mode
| 3-750 | ||||||||||||||||||||||||||||||
2762 | )) & 0170000) == (0040000))
| 3-750 | ||||||||||||||||||||||||||||||
2763 | ) | - | ||||||||||||||||||||||||||||||
2764 | { | - | ||||||||||||||||||||||||||||||
2765 | if (x->move_mode
| 0-3 | ||||||||||||||||||||||||||||||
2766 | { | - | ||||||||||||||||||||||||||||||
2767 | - | |||||||||||||||||||||||||||||||
2768 | - | |||||||||||||||||||||||||||||||
2769 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2770 | else | - | ||||||||||||||||||||||||||||||
2771 | { | - | ||||||||||||||||||||||||||||||
2772 | error (0, 0, | - | ||||||||||||||||||||||||||||||
2773 | - | |||||||||||||||||||||||||||||||
2774 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2775 | "cannot overwrite directory %s with non-directory" | - | ||||||||||||||||||||||||||||||
2776 | , 5) | - | ||||||||||||||||||||||||||||||
2777 | , | - | ||||||||||||||||||||||||||||||
2778 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2779 | return executed 3 times by 1 test: return 0 ; Executed by:
executed 3 times by 1 test: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2780 | 0 executed 3 times by 1 test: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2781 | ; executed 3 times by 1 test: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2782 | } | - | ||||||||||||||||||||||||||||||
2783 | } | - | ||||||||||||||||||||||||||||||
2784 | } executed 750 times by 3 tests: end of block Executed by:
| 750 | ||||||||||||||||||||||||||||||
2785 | - | |||||||||||||||||||||||||||||||
2786 | if (x->move_mode
| 215-559 | ||||||||||||||||||||||||||||||
2787 | { | - | ||||||||||||||||||||||||||||||
2788 | - | |||||||||||||||||||||||||||||||
2789 | if ( | - | ||||||||||||||||||||||||||||||
2790 | ((((
| 7-552 | ||||||||||||||||||||||||||||||
2791 | src_sb.st_mode
| 7-552 | ||||||||||||||||||||||||||||||
2792 | )) & 0170000) == (0040000))
| 7-552 | ||||||||||||||||||||||||||||||
2793 | && !
| 0-7 | ||||||||||||||||||||||||||||||
2794 | ((((
| 0-7 | ||||||||||||||||||||||||||||||
2795 | dst_sb.st_mode
| 0-7 | ||||||||||||||||||||||||||||||
2796 | )) & 0170000) == (0040000))
| 0-7 | ||||||||||||||||||||||||||||||
2797 | - | |||||||||||||||||||||||||||||||
2798 | && x->backup_type == no_backups
| 0 | ||||||||||||||||||||||||||||||
2799 | { | - | ||||||||||||||||||||||||||||||
2800 | error (0, 0, | - | ||||||||||||||||||||||||||||||
2801 | - | |||||||||||||||||||||||||||||||
2802 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2803 | "cannot move directory onto non-directory: %s -> %s" | - | ||||||||||||||||||||||||||||||
2804 | , 5) | - | ||||||||||||||||||||||||||||||
2805 | , | - | ||||||||||||||||||||||||||||||
2806 | quotearg_n_style_colon (0, shell_escape_quoting_style, src_name), quotearg_n_style_colon (0, shell_escape_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2807 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2808 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2809 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2810 | } | - | ||||||||||||||||||||||||||||||
2811 | } executed 559 times by 1 test: end of block Executed by:
| 559 | ||||||||||||||||||||||||||||||
2812 | - | |||||||||||||||||||||||||||||||
2813 | char const *srcbase; | - | ||||||||||||||||||||||||||||||
2814 | if (x->backup_type != no_backups
| 98-676 | ||||||||||||||||||||||||||||||
2815 | - | |||||||||||||||||||||||||||||||
2816 | - | |||||||||||||||||||||||||||||||
2817 | && ! dot_or_dotdot (srcbase = last_component (src_name))
| 1-97 | ||||||||||||||||||||||||||||||
2818 | - | |||||||||||||||||||||||||||||||
2819 | - | |||||||||||||||||||||||||||||||
2820 | - | |||||||||||||||||||||||||||||||
2821 | - | |||||||||||||||||||||||||||||||
2822 | - | |||||||||||||||||||||||||||||||
2823 | && (x->move_mode
| 1-64 | ||||||||||||||||||||||||||||||
2824 | ((((
| 1-63 | ||||||||||||||||||||||||||||||
2825 | dst_sb.st_mode
| 1-63 | ||||||||||||||||||||||||||||||
2826 | )) & 0170000) == (0040000))
| 1-63 | ||||||||||||||||||||||||||||||
2827 | )) | - | ||||||||||||||||||||||||||||||
2828 | { | - | ||||||||||||||||||||||||||||||
2829 | - | |||||||||||||||||||||||||||||||
2830 | - | |||||||||||||||||||||||||||||||
2831 | - | |||||||||||||||||||||||||||||||
2832 | - | |||||||||||||||||||||||||||||||
2833 | if (x->backup_type != numbered_backups
| 45-51 | ||||||||||||||||||||||||||||||
2834 | && source_is_dst_backup (srcbase, &src_sb, dst_name)
| 2-49 | ||||||||||||||||||||||||||||||
2835 | { | - | ||||||||||||||||||||||||||||||
2836 | const char *fmt; | - | ||||||||||||||||||||||||||||||
2837 | fmt = (x->move_mode
| 1 | ||||||||||||||||||||||||||||||
2838 | ? | - | ||||||||||||||||||||||||||||||
2839 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2840 | "backing up %s might destroy source; %s not moved" | - | ||||||||||||||||||||||||||||||
2841 | , 5) | - | ||||||||||||||||||||||||||||||
2842 | - | |||||||||||||||||||||||||||||||
2843 | : | - | ||||||||||||||||||||||||||||||
2844 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2845 | "backing up %s might destroy source; %s not copied" | - | ||||||||||||||||||||||||||||||
2846 | , 5) | - | ||||||||||||||||||||||||||||||
2847 | ); | - | ||||||||||||||||||||||||||||||
2848 | error (0, 0, fmt, | - | ||||||||||||||||||||||||||||||
2849 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name), | - | ||||||||||||||||||||||||||||||
2850 | quotearg_n_style (1, shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
2851 | return executed 2 times by 2 tests: return 0 ; Executed by:
executed 2 times by 2 tests: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2852 | 0 executed 2 times by 2 tests: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2853 | ; executed 2 times by 2 tests: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2854 | } | - | ||||||||||||||||||||||||||||||
2855 | - | |||||||||||||||||||||||||||||||
2856 | char *tmp_backup = backup_file_rename (dst_name, x->backup_type); | - | ||||||||||||||||||||||||||||||
2857 | - | |||||||||||||||||||||||||||||||
2858 | - | |||||||||||||||||||||||||||||||
2859 | - | |||||||||||||||||||||||||||||||
2860 | - | |||||||||||||||||||||||||||||||
2861 | - | |||||||||||||||||||||||||||||||
2862 | - | |||||||||||||||||||||||||||||||
2863 | if (tmp_backup
| 0-94 | ||||||||||||||||||||||||||||||
2864 | { | - | ||||||||||||||||||||||||||||||
2865 | do { dst_backup = | - | ||||||||||||||||||||||||||||||
2866 | (__extension__ ({ const char *__old = ( | - | ||||||||||||||||||||||||||||||
2867 | tmp_backup | - | ||||||||||||||||||||||||||||||
2868 | ); size_t __len = strlen (__old) + 1; char *__new = (char *) __builtin_alloca (__len); (char *) memcpy (__new, __old, __len); })) | - | ||||||||||||||||||||||||||||||
2869 | ; } while (0); | - | ||||||||||||||||||||||||||||||
2870 | free (tmp_backup); | - | ||||||||||||||||||||||||||||||
2871 | } executed 94 times by 3 tests: end of block Executed by:
| 94 | ||||||||||||||||||||||||||||||
2872 | else if ( | - | ||||||||||||||||||||||||||||||
2873 | (*
| 0 | ||||||||||||||||||||||||||||||
2874 | !=
| 0 | ||||||||||||||||||||||||||||||
2875 | 2
| 0 | ||||||||||||||||||||||||||||||
2876 | ) | - | ||||||||||||||||||||||||||||||
2877 | { | - | ||||||||||||||||||||||||||||||
2878 | error (0, | - | ||||||||||||||||||||||||||||||
2879 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
2880 | , | - | ||||||||||||||||||||||||||||||
2881 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2882 | "cannot backup %s" | - | ||||||||||||||||||||||||||||||
2883 | , 5) | - | ||||||||||||||||||||||||||||||
2884 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2885 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2886 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2887 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2888 | } | - | ||||||||||||||||||||||||||||||
2889 | new_dst = | - | ||||||||||||||||||||||||||||||
2890 | 1 | - | ||||||||||||||||||||||||||||||
2891 | ; | - | ||||||||||||||||||||||||||||||
2892 | } executed 94 times by 3 tests: end of block Executed by:
| 94 | ||||||||||||||||||||||||||||||
2893 | else if (!
| 23-655 | ||||||||||||||||||||||||||||||
2894 | ((((
| 23-655 | ||||||||||||||||||||||||||||||
2895 | dst_sb.st_mode
| 23-655 | ||||||||||||||||||||||||||||||
2896 | )) & 0170000) == (0040000))
| 23-655 | ||||||||||||||||||||||||||||||
2897 | - | |||||||||||||||||||||||||||||||
2898 | - | |||||||||||||||||||||||||||||||
2899 | && ! x->move_mode
| 135-520 | ||||||||||||||||||||||||||||||
2900 | && (x->unlink_dest_before_opening
| 16-119 | ||||||||||||||||||||||||||||||
2901 | || (x->preserve_links
| 0-106 | ||||||||||||||||||||||||||||||
2902 | || (x->dereference == DEREF_NEVER
| 11-108 | ||||||||||||||||||||||||||||||
2903 | && !
| 5-6 | ||||||||||||||||||||||||||||||
2904 | ((((
| 5-6 | ||||||||||||||||||||||||||||||
2905 | src_sb.st_mode
| 5-6 | ||||||||||||||||||||||||||||||
2906 | )) & 0170000) == (0100000))
| 5-6 | ||||||||||||||||||||||||||||||
2907 | ) | - | ||||||||||||||||||||||||||||||
2908 | )) | - | ||||||||||||||||||||||||||||||
2909 | { | - | ||||||||||||||||||||||||||||||
2910 | if (unlink (dst_name) != 0
| 0-21 | ||||||||||||||||||||||||||||||
2911 | (*
| 0 | ||||||||||||||||||||||||||||||
2912 | !=
| 0 | ||||||||||||||||||||||||||||||
2913 | 2
| 0 | ||||||||||||||||||||||||||||||
2914 | ) | - | ||||||||||||||||||||||||||||||
2915 | { | - | ||||||||||||||||||||||||||||||
2916 | error (0, | - | ||||||||||||||||||||||||||||||
2917 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
2918 | , | - | ||||||||||||||||||||||||||||||
2919 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2920 | "cannot remove %s" | - | ||||||||||||||||||||||||||||||
2921 | , 5) | - | ||||||||||||||||||||||||||||||
2922 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2923 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2924 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2925 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
2926 | } | - | ||||||||||||||||||||||||||||||
2927 | new_dst = | - | ||||||||||||||||||||||||||||||
2928 | 1 | - | ||||||||||||||||||||||||||||||
2929 | ; | - | ||||||||||||||||||||||||||||||
2930 | if (x->verbose
| 7-14 | ||||||||||||||||||||||||||||||
2931 | printf ( executed 7 times by 1 test: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
2932 | dcgettext (((void *)0), executed 7 times by 1 test: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
2933 | "removed %s\n" executed 7 times by 1 test: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
2934 | , 5) executed 7 times by 1 test: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
2935 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); executed 7 times by 1 test: printf ( dcgettext (((void *)0), "removed %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
2936 | } executed 21 times by 2 tests: end of block Executed by:
| 21 | ||||||||||||||||||||||||||||||
2937 | } executed 772 times by 3 tests: end of block Executed by:
| 772 | ||||||||||||||||||||||||||||||
2938 | } executed 9041 times by 3 tests: end of block Executed by:
| 9041 | ||||||||||||||||||||||||||||||
2939 | - | |||||||||||||||||||||||||||||||
2940 | - | |||||||||||||||||||||||||||||||
2941 | - | |||||||||||||||||||||||||||||||
2942 | if (command_line_arg
| 5149-63951 | ||||||||||||||||||||||||||||||
2943 | && x->dest_info
| 1173-3976 | ||||||||||||||||||||||||||||||
2944 | && ! x->move_mode
| 43-3933 | ||||||||||||||||||||||||||||||
2945 | && x->backup_type == no_backups
| 5-38 | ||||||||||||||||||||||||||||||
2946 | { | - | ||||||||||||||||||||||||||||||
2947 | - | |||||||||||||||||||||||||||||||
2948 | _Bool | - | ||||||||||||||||||||||||||||||
2949 | lstat_ok = | - | ||||||||||||||||||||||||||||||
2950 | 1 | - | ||||||||||||||||||||||||||||||
2951 | ; | - | ||||||||||||||||||||||||||||||
2952 | struct stat tmp_buf; | - | ||||||||||||||||||||||||||||||
2953 | struct stat *dst_lstat_sb; | - | ||||||||||||||||||||||||||||||
2954 | - | |||||||||||||||||||||||||||||||
2955 | - | |||||||||||||||||||||||||||||||
2956 | - | |||||||||||||||||||||||||||||||
2957 | if (have_dst_lstat
| 6-32 | ||||||||||||||||||||||||||||||
2958 | dst_lstat_sb = &dst_sb; executed 6 times by 1 test: dst_lstat_sb = &dst_sb; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2959 | else | - | ||||||||||||||||||||||||||||||
2960 | { | - | ||||||||||||||||||||||||||||||
2961 | if (lstat (dst_name, &tmp_buf) == 0
| 6-26 | ||||||||||||||||||||||||||||||
2962 | dst_lstat_sb = &tmp_buf; executed 6 times by 1 test: dst_lstat_sb = &tmp_buf; Executed by:
| 6 | ||||||||||||||||||||||||||||||
2963 | else | - | ||||||||||||||||||||||||||||||
2964 | lstat_ok = executed 26 times by 2 tests: lstat_ok = 0 ; Executed by:
| 26 | ||||||||||||||||||||||||||||||
2965 | 0 executed 26 times by 2 tests: lstat_ok = 0 ; Executed by:
| 26 | ||||||||||||||||||||||||||||||
2966 | ; executed 26 times by 2 tests: lstat_ok = 0 ; Executed by:
| 26 | ||||||||||||||||||||||||||||||
2967 | } | - | ||||||||||||||||||||||||||||||
2968 | - | |||||||||||||||||||||||||||||||
2969 | - | |||||||||||||||||||||||||||||||
2970 | if (lstat_ok
| 12-26 | ||||||||||||||||||||||||||||||
2971 | && | - | ||||||||||||||||||||||||||||||
2972 | ((((
| 3-9 | ||||||||||||||||||||||||||||||
2973 | dst_lstat_sb->st_mode
| 3-9 | ||||||||||||||||||||||||||||||
2974 | )) & 0170000) == (0120000))
| 3-9 | ||||||||||||||||||||||||||||||
2975 | - | |||||||||||||||||||||||||||||||
2976 | && seen_file (x->dest_info, dst_name, dst_lstat_sb)
| 1-2 | ||||||||||||||||||||||||||||||
2977 | { | - | ||||||||||||||||||||||||||||||
2978 | error (0, 0, | - | ||||||||||||||||||||||||||||||
2979 | - | |||||||||||||||||||||||||||||||
2980 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
2981 | "will not copy %s through just-created symlink %s" | - | ||||||||||||||||||||||||||||||
2982 | , 5) | - | ||||||||||||||||||||||||||||||
2983 | , | - | ||||||||||||||||||||||||||||||
2984 | quotearg_n_style (0, shell_escape_always_quoting_style, src_name), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
2985 | return executed 2 times by 1 test: return 0 ; Executed by:
executed 2 times by 1 test: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2986 | 0 executed 2 times by 1 test: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2987 | ; executed 2 times by 1 test: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2988 | } | - | ||||||||||||||||||||||||||||||
2989 | } executed 36 times by 2 tests: end of block Executed by:
| 36 | ||||||||||||||||||||||||||||||
2990 | - | |||||||||||||||||||||||||||||||
2991 | - | |||||||||||||||||||||||||||||||
2992 | - | |||||||||||||||||||||||||||||||
2993 | - | |||||||||||||||||||||||||||||||
2994 | - | |||||||||||||||||||||||||||||||
2995 | if (x->verbose
| 2-69068 | ||||||||||||||||||||||||||||||
2996 | ((((
| 2-14 | ||||||||||||||||||||||||||||||
2997 | src_mode
| 2-14 | ||||||||||||||||||||||||||||||
2998 | )) & 0170000) == (0040000))
| 2-14 | ||||||||||||||||||||||||||||||
2999 | ) | - | ||||||||||||||||||||||||||||||
3000 | emit_verbose (src_name, dst_name, dst_backup); executed 14 times by 2 tests: emit_verbose (src_name, dst_name, dst_backup); Executed by:
| 14 | ||||||||||||||||||||||||||||||
3001 | if (rename_errno == 0
| 32-69066 | ||||||||||||||||||||||||||||||
3002 | earlier_file = executed 32 times by 1 test: earlier_file = ((void *)0) ; Executed by:
| 32 | ||||||||||||||||||||||||||||||
3003 | ((void *)0) executed 32 times by 1 test: earlier_file = ((void *)0) ; Executed by:
| 32 | ||||||||||||||||||||||||||||||
3004 | ; executed 32 times by 1 test: earlier_file = ((void *)0) ; Executed by:
| 32 | ||||||||||||||||||||||||||||||
3005 | else if (x->recursive
| 575-68491 | ||||||||||||||||||||||||||||||
3006 | ((((
| 33989-34502 | ||||||||||||||||||||||||||||||
3007 | src_mode
| 33989-34502 | ||||||||||||||||||||||||||||||
3008 | )) & 0170000) == (0040000))
| 33989-34502 | ||||||||||||||||||||||||||||||
3009 | ) | - | ||||||||||||||||||||||||||||||
3010 | { | - | ||||||||||||||||||||||||||||||
3011 | if (command_line_arg
| 3966-30023 | ||||||||||||||||||||||||||||||
3012 | earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev); executed 3966 times by 2 tests: earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev); Executed by:
| 3966 | ||||||||||||||||||||||||||||||
3013 | else | - | ||||||||||||||||||||||||||||||
3014 | earlier_file = src_to_dest_lookup (src_sb.st_ino, src_sb.st_dev); executed 30023 times by 2 tests: earlier_file = src_to_dest_lookup (src_sb.st_ino, src_sb.st_dev); Executed by:
| 30023 | ||||||||||||||||||||||||||||||
3015 | } | - | ||||||||||||||||||||||||||||||
3016 | else if (x->move_mode
| 10-30609 | ||||||||||||||||||||||||||||||
3017 | { | - | ||||||||||||||||||||||||||||||
3018 | earlier_file = src_to_dest_lookup (src_sb.st_ino, src_sb.st_dev); | - | ||||||||||||||||||||||||||||||
3019 | } executed 4458 times by 1 test: end of block Executed by:
| 4458 | ||||||||||||||||||||||||||||||
3020 | else if (x->preserve_links
| 556-30063 | ||||||||||||||||||||||||||||||
3021 | && !x->hard_link
| 56-30007 | ||||||||||||||||||||||||||||||
3022 | && (1 < src_sb.st_nlink
| 26-30 | ||||||||||||||||||||||||||||||
3023 | || (command_line_arg
| 2-24 | ||||||||||||||||||||||||||||||
3024 | && x->dereference == DEREF_COMMAND_LINE_ARGUMENTS
| 2-22 | ||||||||||||||||||||||||||||||
3025 | || x->dereference == DEREF_ALWAYS
| 4-20 | ||||||||||||||||||||||||||||||
3026 | { | - | ||||||||||||||||||||||||||||||
3027 | earlier_file = remember_copied (dst_name, src_sb.st_ino, src_sb.st_dev); | - | ||||||||||||||||||||||||||||||
3028 | } executed 36 times by 2 tests: end of block Executed by:
| 36 | ||||||||||||||||||||||||||||||
3029 | - | |||||||||||||||||||||||||||||||
3030 | - | |||||||||||||||||||||||||||||||
3031 | - | |||||||||||||||||||||||||||||||
3032 | - | |||||||||||||||||||||||||||||||
3033 | if (earlier_file
| 25-69073 | ||||||||||||||||||||||||||||||
3034 | { | - | ||||||||||||||||||||||||||||||
3035 | - | |||||||||||||||||||||||||||||||
3036 | - | |||||||||||||||||||||||||||||||
3037 | - | |||||||||||||||||||||||||||||||
3038 | if ( | - | ||||||||||||||||||||||||||||||
3039 | ((((
| 8-17 | ||||||||||||||||||||||||||||||
3040 | src_mode
| 8-17 | ||||||||||||||||||||||||||||||
3041 | )) & 0170000) == (0040000))
| 8-17 | ||||||||||||||||||||||||||||||
3042 | ) | - | ||||||||||||||||||||||||||||||
3043 | { | - | ||||||||||||||||||||||||||||||
3044 | - | |||||||||||||||||||||||||||||||
3045 | - | |||||||||||||||||||||||||||||||
3046 | if (same_name (src_name, earlier_file)
| 3-5 | ||||||||||||||||||||||||||||||
3047 | { | - | ||||||||||||||||||||||||||||||
3048 | error (0, 0, | - | ||||||||||||||||||||||||||||||
3049 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3050 | "cannot copy a directory, %s, into itself, %s" | - | ||||||||||||||||||||||||||||||
3051 | , 5) | - | ||||||||||||||||||||||||||||||
3052 | , | - | ||||||||||||||||||||||||||||||
3053 | quotearg_n_style (0, shell_escape_always_quoting_style, top_level_src_name), | - | ||||||||||||||||||||||||||||||
3054 | quotearg_n_style (1, shell_escape_always_quoting_style, top_level_dst_name)); | - | ||||||||||||||||||||||||||||||
3055 | *copy_into_self = | - | ||||||||||||||||||||||||||||||
3056 | 1 | - | ||||||||||||||||||||||||||||||
3057 | ; | - | ||||||||||||||||||||||||||||||
3058 | goto executed 5 times by 1 test: un_backup;goto un_backup; Executed by:
executed 5 times by 1 test: goto un_backup; Executed by:
| 5 | ||||||||||||||||||||||||||||||
3059 | } | - | ||||||||||||||||||||||||||||||
3060 | else if (same_name (dst_name, earlier_file)
| 0-3 | ||||||||||||||||||||||||||||||
3061 | { | - | ||||||||||||||||||||||||||||||
3062 | error (0, 0, | - | ||||||||||||||||||||||||||||||
3063 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3064 | "warning: source directory %s " "specified more than once" | - | ||||||||||||||||||||||||||||||
3065 | , 5) | - | ||||||||||||||||||||||||||||||
3066 | - | |||||||||||||||||||||||||||||||
3067 | , | - | ||||||||||||||||||||||||||||||
3068 | quotearg_style (shell_escape_always_quoting_style, top_level_src_name)); | - | ||||||||||||||||||||||||||||||
3069 | - | |||||||||||||||||||||||||||||||
3070 | - | |||||||||||||||||||||||||||||||
3071 | - | |||||||||||||||||||||||||||||||
3072 | - | |||||||||||||||||||||||||||||||
3073 | if (x->move_mode
| 0-2 | ||||||||||||||||||||||||||||||
3074 | * executed 1 time by 1 test: rename_succeeded = *rename_succeeded = 1 ; Executed by:
executed 1 time by 1 test: *rename_succeeded = 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
3075 | 1 executed 1 time by 1 test: *rename_succeeded = 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
3076 | ; executed 1 time by 1 test: *rename_succeeded = 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
3077 | - | |||||||||||||||||||||||||||||||
3078 | - | |||||||||||||||||||||||||||||||
3079 | return executed 3 times by 2 tests: return 1 ; Executed by:
executed 3 times by 2 tests: return 1 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3080 | 1 executed 3 times by 2 tests: return 1 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3081 | ; executed 3 times by 2 tests: return 1 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3082 | } | - | ||||||||||||||||||||||||||||||
3083 | else if (x->dereference == DEREF_ALWAYS
| 0 | ||||||||||||||||||||||||||||||
3084 | || (command_line_arg
| 0 | ||||||||||||||||||||||||||||||
3085 | && x->dereference == DEREF_COMMAND_LINE_ARGUMENTS
| 0 | ||||||||||||||||||||||||||||||
3086 | { | - | ||||||||||||||||||||||||||||||
3087 | - | |||||||||||||||||||||||||||||||
3088 | - | |||||||||||||||||||||||||||||||
3089 | - | |||||||||||||||||||||||||||||||
3090 | - | |||||||||||||||||||||||||||||||
3091 | - | |||||||||||||||||||||||||||||||
3092 | - | |||||||||||||||||||||||||||||||
3093 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3094 | else | - | ||||||||||||||||||||||||||||||
3095 | { | - | ||||||||||||||||||||||||||||||
3096 | error (0, 0, | - | ||||||||||||||||||||||||||||||
3097 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3098 | "will not create hard link %s to directory %s" | - | ||||||||||||||||||||||||||||||
3099 | , 5) | - | ||||||||||||||||||||||||||||||
3100 | , | - | ||||||||||||||||||||||||||||||
3101 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name), quotearg_n_style (1, shell_escape_always_quoting_style, earlier_file)); | - | ||||||||||||||||||||||||||||||
3102 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3103 | } | - | ||||||||||||||||||||||||||||||
3104 | } | - | ||||||||||||||||||||||||||||||
3105 | else | - | ||||||||||||||||||||||||||||||
3106 | { | - | ||||||||||||||||||||||||||||||
3107 | if (! create_hard_link (earlier_file, dst_name,
| 1-16 | ||||||||||||||||||||||||||||||
3108 | 1
| 1-16 | ||||||||||||||||||||||||||||||
3109 | , x->verbose,
| 1-16 | ||||||||||||||||||||||||||||||
3110 | dereference)
| 1-16 | ||||||||||||||||||||||||||||||
3111 | goto executed 1 time by 1 test: un_backup;goto un_backup; Executed by:
executed 1 time by 1 test: goto un_backup; Executed by:
| 1 | ||||||||||||||||||||||||||||||
3112 | - | |||||||||||||||||||||||||||||||
3113 | return executed 16 times by 2 tests: return 1 ; Executed by:
executed 16 times by 2 tests: return 1 ; Executed by:
| 16 | ||||||||||||||||||||||||||||||
3114 | 1 executed 16 times by 2 tests: return 1 ; Executed by:
| 16 | ||||||||||||||||||||||||||||||
3115 | ; executed 16 times by 2 tests: return 1 ; Executed by:
| 16 | ||||||||||||||||||||||||||||||
3116 | } | - | ||||||||||||||||||||||||||||||
3117 | } | - | ||||||||||||||||||||||||||||||
3118 | - | |||||||||||||||||||||||||||||||
3119 | if (x->move_mode
| 8423-60650 | ||||||||||||||||||||||||||||||
3120 | { | - | ||||||||||||||||||||||||||||||
3121 | if (rename_errno ==
| 556-7867 | ||||||||||||||||||||||||||||||
3122 | 17
| 556-7867 | ||||||||||||||||||||||||||||||
3123 | ) | - | ||||||||||||||||||||||||||||||
3124 | rename_errno = rename (src_name, dst_name) == 0
executed 556 times by 1 test: rename_errno = rename (src_name, dst_name) == 0 ? 0 : (*__errno_location ()) ; Executed by:
| 13-556 | ||||||||||||||||||||||||||||||
3125 | (*__errno_location ()) executed 556 times by 1 test: rename_errno = rename (src_name, dst_name) == 0 ? 0 : (*__errno_location ()) ; Executed by:
| 556 | ||||||||||||||||||||||||||||||
3126 | ; executed 556 times by 1 test: rename_errno = rename (src_name, dst_name) == 0 ? 0 : (*__errno_location ()) ; Executed by:
| 556 | ||||||||||||||||||||||||||||||
3127 | - | |||||||||||||||||||||||||||||||
3128 | if (rename_errno == 0
| 575-7848 | ||||||||||||||||||||||||||||||
3129 | { | - | ||||||||||||||||||||||||||||||
3130 | if (x->verbose
| 2-573 | ||||||||||||||||||||||||||||||
3131 | { | - | ||||||||||||||||||||||||||||||
3132 | printf ( | - | ||||||||||||||||||||||||||||||
3133 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3134 | "renamed " | - | ||||||||||||||||||||||||||||||
3135 | , 5) | - | ||||||||||||||||||||||||||||||
3136 | ); | - | ||||||||||||||||||||||||||||||
3137 | emit_verbose (src_name, dst_name, dst_backup); | - | ||||||||||||||||||||||||||||||
3138 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
3139 | - | |||||||||||||||||||||||||||||||
3140 | if (x->set_security_context
| 0-575 | ||||||||||||||||||||||||||||||
3141 | { | - | ||||||||||||||||||||||||||||||
3142 | - | |||||||||||||||||||||||||||||||
3143 | (void) set_file_security_ctx (dst_name, | - | ||||||||||||||||||||||||||||||
3144 | 0 | - | ||||||||||||||||||||||||||||||
3145 | , | - | ||||||||||||||||||||||||||||||
3146 | 1 | - | ||||||||||||||||||||||||||||||
3147 | , x); | - | ||||||||||||||||||||||||||||||
3148 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3149 | - | |||||||||||||||||||||||||||||||
3150 | if (rename_succeeded
| 0-575 | ||||||||||||||||||||||||||||||
3151 | * executed 575 times by 1 test: rename_succeeded = *rename_succeeded = 1 ; Executed by:
executed 575 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 575 | ||||||||||||||||||||||||||||||
3152 | 1 executed 575 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 575 | ||||||||||||||||||||||||||||||
3153 | ; executed 575 times by 1 test: *rename_succeeded = 1 ; Executed by:
| 575 | ||||||||||||||||||||||||||||||
3154 | - | |||||||||||||||||||||||||||||||
3155 | if (command_line_arg
| 0-575 | ||||||||||||||||||||||||||||||
3156 | { | - | ||||||||||||||||||||||||||||||
3157 | - | |||||||||||||||||||||||||||||||
3158 | - | |||||||||||||||||||||||||||||||
3159 | - | |||||||||||||||||||||||||||||||
3160 | - | |||||||||||||||||||||||||||||||
3161 | - | |||||||||||||||||||||||||||||||
3162 | - | |||||||||||||||||||||||||||||||
3163 | - | |||||||||||||||||||||||||||||||
3164 | record_file (x->dest_info, dst_name, &src_sb); | - | ||||||||||||||||||||||||||||||
3165 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||
3166 | - | |||||||||||||||||||||||||||||||
3167 | return executed 575 times by 1 test: return 1 ; Executed by:
executed 575 times by 1 test: return 1 ; Executed by:
| 575 | ||||||||||||||||||||||||||||||
3168 | 1 executed 575 times by 1 test: return 1 ; Executed by:
| 575 | ||||||||||||||||||||||||||||||
3169 | ; executed 575 times by 1 test: return 1 ; Executed by:
| 575 | ||||||||||||||||||||||||||||||
3170 | } | - | ||||||||||||||||||||||||||||||
3171 | - | |||||||||||||||||||||||||||||||
3172 | - | |||||||||||||||||||||||||||||||
3173 | - | |||||||||||||||||||||||||||||||
3174 | - | |||||||||||||||||||||||||||||||
3175 | - | |||||||||||||||||||||||||||||||
3176 | - | |||||||||||||||||||||||||||||||
3177 | if (rename_errno ==
| 3-7845 | ||||||||||||||||||||||||||||||
3178 | 22
| 3-7845 | ||||||||||||||||||||||||||||||
3179 | ) | - | ||||||||||||||||||||||||||||||
3180 | { | - | ||||||||||||||||||||||||||||||
3181 | - | |||||||||||||||||||||||||||||||
3182 | - | |||||||||||||||||||||||||||||||
3183 | - | |||||||||||||||||||||||||||||||
3184 | error (0, 0, | - | ||||||||||||||||||||||||||||||
3185 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3186 | "cannot move %s to a subdirectory of itself, %s" | - | ||||||||||||||||||||||||||||||
3187 | , 5) | - | ||||||||||||||||||||||||||||||
3188 | , | - | ||||||||||||||||||||||||||||||
3189 | quotearg_n_style (0, shell_escape_always_quoting_style, top_level_src_name), | - | ||||||||||||||||||||||||||||||
3190 | quotearg_n_style (1, shell_escape_always_quoting_style, top_level_dst_name)); | - | ||||||||||||||||||||||||||||||
3191 | - | |||||||||||||||||||||||||||||||
3192 | - | |||||||||||||||||||||||||||||||
3193 | - | |||||||||||||||||||||||||||||||
3194 | - | |||||||||||||||||||||||||||||||
3195 | - | |||||||||||||||||||||||||||||||
3196 | *copy_into_self = | - | ||||||||||||||||||||||||||||||
3197 | 1 | - | ||||||||||||||||||||||||||||||
3198 | ; | - | ||||||||||||||||||||||||||||||
3199 | - | |||||||||||||||||||||||||||||||
3200 | - | |||||||||||||||||||||||||||||||
3201 | - | |||||||||||||||||||||||||||||||
3202 | return executed 3 times by 1 test: return 1 ; Executed by:
executed 3 times by 1 test: return 1 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3203 | 1 executed 3 times by 1 test: return 1 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3204 | ; executed 3 times by 1 test: return 1 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3205 | } | - | ||||||||||||||||||||||||||||||
3206 | if (rename_errno !=
| 3-7842 | ||||||||||||||||||||||||||||||
3207 | 18
| 3-7842 | ||||||||||||||||||||||||||||||
3208 | ) | - | ||||||||||||||||||||||||||||||
3209 | { | - | ||||||||||||||||||||||||||||||
3210 | error (0, rename_errno, | - | ||||||||||||||||||||||||||||||
3211 | - | |||||||||||||||||||||||||||||||
3212 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3213 | "cannot move %s to %s" | - | ||||||||||||||||||||||||||||||
3214 | , 5) | - | ||||||||||||||||||||||||||||||
3215 | , | - | ||||||||||||||||||||||||||||||
3216 | quotearg_n_style (0, shell_escape_always_quoting_style, src_name), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3217 | forget_created (src_sb.st_ino, src_sb.st_dev); | - | ||||||||||||||||||||||||||||||
3218 | return executed 3 times by 1 test: return 0 ; Executed by:
executed 3 times by 1 test: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3219 | 0 executed 3 times by 1 test: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3220 | ; executed 3 times by 1 test: return 0 ; Executed by:
| 3 | ||||||||||||||||||||||||||||||
3221 | } | - | ||||||||||||||||||||||||||||||
3222 | - | |||||||||||||||||||||||||||||||
3223 | - | |||||||||||||||||||||||||||||||
3224 | - | |||||||||||||||||||||||||||||||
3225 | - | |||||||||||||||||||||||||||||||
3226 | - | |||||||||||||||||||||||||||||||
3227 | - | |||||||||||||||||||||||||||||||
3228 | - | |||||||||||||||||||||||||||||||
3229 | if ((
| 5-7837 | ||||||||||||||||||||||||||||||
3230 | ((((
| 5-7837 | ||||||||||||||||||||||||||||||
3231 | src_mode
| 5-7837 | ||||||||||||||||||||||||||||||
3232 | )) & 0170000) == (0040000))
| 5-7837 | ||||||||||||||||||||||||||||||
3233 | ? rmdir (dst_name) : unlink (dst_name)) != 0
| 5-7837 | ||||||||||||||||||||||||||||||
3234 | && | - | ||||||||||||||||||||||||||||||
3235 | (*
| 2-7835 | ||||||||||||||||||||||||||||||
3236 | !=
| 2-7835 | ||||||||||||||||||||||||||||||
3237 | 2
| 2-7835 | ||||||||||||||||||||||||||||||
3238 | ) | - | ||||||||||||||||||||||||||||||
3239 | { | - | ||||||||||||||||||||||||||||||
3240 | error (0, | - | ||||||||||||||||||||||||||||||
3241 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3242 | , | - | ||||||||||||||||||||||||||||||
3243 | - | |||||||||||||||||||||||||||||||
3244 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3245 | "inter-device move failed: %s to %s; unable to remove target" | - | ||||||||||||||||||||||||||||||
3246 | , 5) | - | ||||||||||||||||||||||||||||||
3247 | , | - | ||||||||||||||||||||||||||||||
3248 | quotearg_n_style (0, shell_escape_always_quoting_style, src_name), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3249 | forget_created (src_sb.st_ino, src_sb.st_dev); | - | ||||||||||||||||||||||||||||||
3250 | return executed 2 times by 1 test: return 0 ; Executed by:
executed 2 times by 1 test: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
3251 | 0 executed 2 times by 1 test: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
3252 | ; executed 2 times by 1 test: return 0 ; Executed by:
| 2 | ||||||||||||||||||||||||||||||
3253 | } | - | ||||||||||||||||||||||||||||||
3254 | - | |||||||||||||||||||||||||||||||
3255 | if (x->verbose
| 3-7830 | ||||||||||||||||||||||||||||||
3256 | ((((
| 3-7 | ||||||||||||||||||||||||||||||
3257 | src_mode
| 3-7 | ||||||||||||||||||||||||||||||
3258 | )) & 0170000) == (0040000))
| 3-7 | ||||||||||||||||||||||||||||||
3259 | ) | - | ||||||||||||||||||||||||||||||
3260 | { | - | ||||||||||||||||||||||||||||||
3261 | printf ( | - | ||||||||||||||||||||||||||||||
3262 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3263 | "copied " | - | ||||||||||||||||||||||||||||||
3264 | , 5) | - | ||||||||||||||||||||||||||||||
3265 | ); | - | ||||||||||||||||||||||||||||||
3266 | emit_verbose (src_name, dst_name, dst_backup); | - | ||||||||||||||||||||||||||||||
3267 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||||||||
3268 | new_dst = | - | ||||||||||||||||||||||||||||||
3269 | 1 | - | ||||||||||||||||||||||||||||||
3270 | ; | - | ||||||||||||||||||||||||||||||
3271 | } executed 7840 times by 1 test: end of block Executed by:
| 7840 | ||||||||||||||||||||||||||||||
3272 | - | |||||||||||||||||||||||||||||||
3273 | - | |||||||||||||||||||||||||||||||
3274 | - | |||||||||||||||||||||||||||||||
3275 | - | |||||||||||||||||||||||||||||||
3276 | - | |||||||||||||||||||||||||||||||
3277 | dst_mode_bits = (x->set_mode
| 22-68468 | ||||||||||||||||||||||||||||||
3278 | 04000 | - | ||||||||||||||||||||||||||||||
3279 | | | - | ||||||||||||||||||||||||||||||
3280 | 02000 | - | ||||||||||||||||||||||||||||||
3281 | | | - | ||||||||||||||||||||||||||||||
3282 | 01000 | - | ||||||||||||||||||||||||||||||
3283 | | | - | ||||||||||||||||||||||||||||||
3284 | (0400|0200|0100) | - | ||||||||||||||||||||||||||||||
3285 | | | - | ||||||||||||||||||||||||||||||
3286 | ((0400|0200|0100) >> 3) | - | ||||||||||||||||||||||||||||||
3287 | | | - | ||||||||||||||||||||||||||||||
3288 | (((0400|0200|0100) >> 3) >> 3) | - | ||||||||||||||||||||||||||||||
3289 | ); | - | ||||||||||||||||||||||||||||||
3290 | omitted_permissions = | - | ||||||||||||||||||||||||||||||
3291 | (dst_mode_bits | - | ||||||||||||||||||||||||||||||
3292 | & (x->preserve_ownership ? | - | ||||||||||||||||||||||||||||||
3293 | ((0400|0200|0100) >> 3) | - | ||||||||||||||||||||||||||||||
3294 | | | - | ||||||||||||||||||||||||||||||
3295 | (((0400|0200|0100) >> 3) >> 3) | - | ||||||||||||||||||||||||||||||
3296 | - | |||||||||||||||||||||||||||||||
3297 | : | - | ||||||||||||||||||||||||||||||
3298 | (((( | - | ||||||||||||||||||||||||||||||
3299 | src_mode | - | ||||||||||||||||||||||||||||||
3300 | )) & 0170000) == (0040000)) | - | ||||||||||||||||||||||||||||||
3301 | ? | - | ||||||||||||||||||||||||||||||
3302 | (0200 >> 3) | - | ||||||||||||||||||||||||||||||
3303 | | | - | ||||||||||||||||||||||||||||||
3304 | ((0200 >> 3) >> 3) | - | ||||||||||||||||||||||||||||||
3305 | - | |||||||||||||||||||||||||||||||
3306 | : 0)); | - | ||||||||||||||||||||||||||||||
3307 | - | |||||||||||||||||||||||||||||||
3308 | delayed_ok = | - | ||||||||||||||||||||||||||||||
3309 | 1 | - | ||||||||||||||||||||||||||||||
3310 | ; | - | ||||||||||||||||||||||||||||||
3311 | - | |||||||||||||||||||||||||||||||
3312 | - | |||||||||||||||||||||||||||||||
3313 | - | |||||||||||||||||||||||||||||||
3314 | - | |||||||||||||||||||||||||||||||
3315 | - | |||||||||||||||||||||||||||||||
3316 | if (! set_process_security_ctx (src_name, dst_name, src_mode, new_dst, x)
| 0-68490 | ||||||||||||||||||||||||||||||
3317 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3318 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3319 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3320 | - | |||||||||||||||||||||||||||||||
3321 | if ( | - | ||||||||||||||||||||||||||||||
3322 | ((((
| 33971-34519 | ||||||||||||||||||||||||||||||
3323 | src_mode
| 33971-34519 | ||||||||||||||||||||||||||||||
3324 | )) & 0170000) == (0040000))
| 33971-34519 | ||||||||||||||||||||||||||||||
3325 | ) | - | ||||||||||||||||||||||||||||||
3326 | { | - | ||||||||||||||||||||||||||||||
3327 | struct dir_list *dir; | - | ||||||||||||||||||||||||||||||
3328 | - | |||||||||||||||||||||||||||||||
3329 | - | |||||||||||||||||||||||||||||||
3330 | - | |||||||||||||||||||||||||||||||
3331 | - | |||||||||||||||||||||||||||||||
3332 | - | |||||||||||||||||||||||||||||||
3333 | - | |||||||||||||||||||||||||||||||
3334 | if (is_ancestor (&src_sb, ancestors)
| 0-33971 | ||||||||||||||||||||||||||||||
3335 | { | - | ||||||||||||||||||||||||||||||
3336 | error (0, 0, | - | ||||||||||||||||||||||||||||||
3337 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3338 | "cannot copy cyclic symbolic link %s" | - | ||||||||||||||||||||||||||||||
3339 | , 5) | - | ||||||||||||||||||||||||||||||
3340 | , | - | ||||||||||||||||||||||||||||||
3341 | quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
3342 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3343 | } | - | ||||||||||||||||||||||||||||||
3344 | - | |||||||||||||||||||||||||||||||
3345 | - | |||||||||||||||||||||||||||||||
3346 | - | |||||||||||||||||||||||||||||||
3347 | dir = __builtin_alloca (sizeof *dir); | - | ||||||||||||||||||||||||||||||
3348 | dir->parent = ancestors; | - | ||||||||||||||||||||||||||||||
3349 | dir->ino = src_sb.st_ino; | - | ||||||||||||||||||||||||||||||
3350 | dir->dev = src_sb.st_dev; | - | ||||||||||||||||||||||||||||||
3351 | - | |||||||||||||||||||||||||||||||
3352 | if (new_dst
| 0-33956 | ||||||||||||||||||||||||||||||
3353 | ((((
| 0-15 | ||||||||||||||||||||||||||||||
3354 | dst_sb.st_mode
| 0-15 | ||||||||||||||||||||||||||||||
3355 | )) & 0170000) == (0040000))
| 0-15 | ||||||||||||||||||||||||||||||
3356 | ) | - | ||||||||||||||||||||||||||||||
3357 | { | - | ||||||||||||||||||||||||||||||
3358 | - | |||||||||||||||||||||||||||||||
3359 | - | |||||||||||||||||||||||||||||||
3360 | - | |||||||||||||||||||||||||||||||
3361 | - | |||||||||||||||||||||||||||||||
3362 | if (mkdir (dst_name, dst_mode_bits & ~omitted_permissions) != 0
| 0-33956 | ||||||||||||||||||||||||||||||
3363 | { | - | ||||||||||||||||||||||||||||||
3364 | error (0, | - | ||||||||||||||||||||||||||||||
3365 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3366 | , | - | ||||||||||||||||||||||||||||||
3367 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3368 | "cannot create directory %s" | - | ||||||||||||||||||||||||||||||
3369 | , 5) | - | ||||||||||||||||||||||||||||||
3370 | , | - | ||||||||||||||||||||||||||||||
3371 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3372 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3373 | } | - | ||||||||||||||||||||||||||||||
3374 | - | |||||||||||||||||||||||||||||||
3375 | - | |||||||||||||||||||||||||||||||
3376 | - | |||||||||||||||||||||||||||||||
3377 | - | |||||||||||||||||||||||||||||||
3378 | - | |||||||||||||||||||||||||||||||
3379 | if (lstat (dst_name, &dst_sb) != 0
| 0-33956 | ||||||||||||||||||||||||||||||
3380 | { | - | ||||||||||||||||||||||||||||||
3381 | error (0, | - | ||||||||||||||||||||||||||||||
3382 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3383 | , | - | ||||||||||||||||||||||||||||||
3384 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3385 | "cannot stat %s" | - | ||||||||||||||||||||||||||||||
3386 | , 5) | - | ||||||||||||||||||||||||||||||
3387 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3388 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3389 | } | - | ||||||||||||||||||||||||||||||
3390 | else if ((
| 1-33955 | ||||||||||||||||||||||||||||||
3391 | (0400|0200|0100)
| 1-33955 | ||||||||||||||||||||||||||||||
3392 | ) !=
| 1-33955 | ||||||||||||||||||||||||||||||
3393 | (0400|0200|0100)
| 1-33955 | ||||||||||||||||||||||||||||||
3394 | ) | - | ||||||||||||||||||||||||||||||
3395 | { | - | ||||||||||||||||||||||||||||||
3396 | - | |||||||||||||||||||||||||||||||
3397 | - | |||||||||||||||||||||||||||||||
3398 | dst_mode = dst_sb.st_mode; | - | ||||||||||||||||||||||||||||||
3399 | restore_dst_mode = | - | ||||||||||||||||||||||||||||||
3400 | 1 | - | ||||||||||||||||||||||||||||||
3401 | ; | - | ||||||||||||||||||||||||||||||
3402 | - | |||||||||||||||||||||||||||||||
3403 | if ( | - | ||||||||||||||||||||||||||||||
3404 | chmod
| 0-1 | ||||||||||||||||||||||||||||||
3405 | (dst_name, dst_mode |
| 0-1 | ||||||||||||||||||||||||||||||
3406 | (0400|0200|0100)
| 0-1 | ||||||||||||||||||||||||||||||
3407 | ) != 0
| 0-1 | ||||||||||||||||||||||||||||||
3408 | { | - | ||||||||||||||||||||||||||||||
3409 | error (0, | - | ||||||||||||||||||||||||||||||
3410 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3411 | , | - | ||||||||||||||||||||||||||||||
3412 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3413 | "setting permissions for %s" | - | ||||||||||||||||||||||||||||||
3414 | , 5) | - | ||||||||||||||||||||||||||||||
3415 | , | - | ||||||||||||||||||||||||||||||
3416 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3417 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3418 | } | - | ||||||||||||||||||||||||||||||
3419 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
3420 | - | |||||||||||||||||||||||||||||||
3421 | - | |||||||||||||||||||||||||||||||
3422 | - | |||||||||||||||||||||||||||||||
3423 | - | |||||||||||||||||||||||||||||||
3424 | - | |||||||||||||||||||||||||||||||
3425 | if (!*first_dir_created_per_command_line_arg
| 3945-30011 | ||||||||||||||||||||||||||||||
3426 | { | - | ||||||||||||||||||||||||||||||
3427 | remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev); | - | ||||||||||||||||||||||||||||||
3428 | *first_dir_created_per_command_line_arg = | - | ||||||||||||||||||||||||||||||
3429 | 1 | - | ||||||||||||||||||||||||||||||
3430 | ; | - | ||||||||||||||||||||||||||||||
3431 | } executed 3945 times by 2 tests: end of block Executed by:
| 3945 | ||||||||||||||||||||||||||||||
3432 | - | |||||||||||||||||||||||||||||||
3433 | if (x->verbose
| 8-33948 | ||||||||||||||||||||||||||||||
3434 | { | - | ||||||||||||||||||||||||||||||
3435 | if (x->move_mode
| 1-7 | ||||||||||||||||||||||||||||||
3436 | printf ( executed 7 times by 1 test: printf ( dcgettext (((void *)0), "created directory %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
3437 | dcgettext (((void *)0), executed 7 times by 1 test: printf ( dcgettext (((void *)0), "created directory %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
3438 | "created directory %s\n" executed 7 times by 1 test: printf ( dcgettext (((void *)0), "created directory %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
3439 | , 5) executed 7 times by 1 test: printf ( dcgettext (((void *)0), "created directory %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
3440 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); executed 7 times by 1 test: printf ( dcgettext (((void *)0), "created directory %s\n" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); Executed by:
| 7 | ||||||||||||||||||||||||||||||
3441 | else | - | ||||||||||||||||||||||||||||||
3442 | emit_verbose (src_name, dst_name, executed 1 time by 1 test: emit_verbose (src_name, dst_name, ((void *)0) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||
3443 | ((void *)0) executed 1 time by 1 test: emit_verbose (src_name, dst_name, ((void *)0) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||
3444 | ); executed 1 time by 1 test: emit_verbose (src_name, dst_name, ((void *)0) ); Executed by:
| 1 | ||||||||||||||||||||||||||||||
3445 | } | - | ||||||||||||||||||||||||||||||
3446 | } executed 33956 times by 2 tests: end of block Executed by:
| 33956 | ||||||||||||||||||||||||||||||
3447 | else | - | ||||||||||||||||||||||||||||||
3448 | { | - | ||||||||||||||||||||||||||||||
3449 | omitted_permissions = 0; | - | ||||||||||||||||||||||||||||||
3450 | - | |||||||||||||||||||||||||||||||
3451 | - | |||||||||||||||||||||||||||||||
3452 | - | |||||||||||||||||||||||||||||||
3453 | - | |||||||||||||||||||||||||||||||
3454 | if (x->set_security_context
| 0-15 | ||||||||||||||||||||||||||||||
3455 | if (! set_file_security_ctx (dst_name, x->preserve_security_context,
| 0 | ||||||||||||||||||||||||||||||
3456 |
| 0 | ||||||||||||||||||||||||||||||
3457 | 0
| 0 | ||||||||||||||||||||||||||||||
3458 | , x)
| 0 | ||||||||||||||||||||||||||||||
3459 | { | - | ||||||||||||||||||||||||||||||
3460 | if (x->require_preserve_context
| 0 | ||||||||||||||||||||||||||||||
3461 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3462 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3463 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||||||||||||||||||||
3464 | - | |||||||||||||||||||||||||||||||
3465 | - | |||||||||||||||||||||||||||||||
3466 | if (x->one_file_system
| 0-33971 | ||||||||||||||||||||||||||||||
3467 | { | - | ||||||||||||||||||||||||||||||
3468 | - | |||||||||||||||||||||||||||||||
3469 | - | |||||||||||||||||||||||||||||||
3470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3471 | else | - | ||||||||||||||||||||||||||||||
3472 | { | - | ||||||||||||||||||||||||||||||
3473 | - | |||||||||||||||||||||||||||||||
3474 | - | |||||||||||||||||||||||||||||||
3475 | - | |||||||||||||||||||||||||||||||
3476 | - | |||||||||||||||||||||||||||||||
3477 | delayed_ok = copy_dir (src_name, dst_name, new_dst, &src_sb, dir, x, | - | ||||||||||||||||||||||||||||||
3478 | first_dir_created_per_command_line_arg, | - | ||||||||||||||||||||||||||||||
3479 | copy_into_self); | - | ||||||||||||||||||||||||||||||
3480 | } executed 33971 times by 2 tests: end of block Executed by:
| 33971 | ||||||||||||||||||||||||||||||
3481 | } | - | ||||||||||||||||||||||||||||||
3482 | else if (x->symbolic_link
| 1-34518 | ||||||||||||||||||||||||||||||
3483 | { | - | ||||||||||||||||||||||||||||||
3484 | dest_is_symlink = | - | ||||||||||||||||||||||||||||||
3485 | 1 | - | ||||||||||||||||||||||||||||||
3486 | ; | - | ||||||||||||||||||||||||||||||
3487 | if (*
| 0-1 | ||||||||||||||||||||||||||||||
3488 | { | - | ||||||||||||||||||||||||||||||
3489 | - | |||||||||||||||||||||||||||||||
3490 | struct stat dot_sb; | - | ||||||||||||||||||||||||||||||
3491 | struct stat dst_parent_sb; | - | ||||||||||||||||||||||||||||||
3492 | char *dst_parent; | - | ||||||||||||||||||||||||||||||
3493 | - | |||||||||||||||||||||||||||||||
3494 | _Bool | - | ||||||||||||||||||||||||||||||
3495 | in_current_dir; | - | ||||||||||||||||||||||||||||||
3496 | - | |||||||||||||||||||||||||||||||
3497 | dst_parent = dir_name (dst_name); | - | ||||||||||||||||||||||||||||||
3498 | - | |||||||||||||||||||||||||||||||
3499 | in_current_dir = ((
| 0-1 | ||||||||||||||||||||||||||||||
3500 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
| 0-1 | ||||||||||||||||||||||||||||||
3501 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3502 | ) && __builtin_constant_p (
| 0-1 | ||||||||||||||||||||||||||||||
3503 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3504 | ) && (__s1_len = __builtin_strlen (
| 0-1 | ||||||||||||||||||||||||||||||
3505 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3506 | ), __s2_len = __builtin_strlen (
| 0-1 | ||||||||||||||||||||||||||||||
3507 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3508 | ), (!((size_t)(const void *)((
| 0-1 | ||||||||||||||||||||||||||||||
3509 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3510 | ) + 1) - (size_t)(const void *)(
| 0-1 | ||||||||||||||||||||||||||||||
3511 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3512 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
| 0-1 | ||||||||||||||||||||||||||||||
3513 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3514 | ) + 1) - (size_t)(const void *)(
| 0-1 | ||||||||||||||||||||||||||||||
3515 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3516 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
| 0-1 | ||||||||||||||||||||||||||||||
3517 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3518 | ,
| 0-1 | ||||||||||||||||||||||||||||||
3519 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3520 | ) : (__builtin_constant_p (
| 0-1 | ||||||||||||||||||||||||||||||
3521 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3522 | ) && ((size_t)(const void *)((
| 0-1 | ||||||||||||||||||||||||||||||
3523 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3524 | ) + 1) - (size_t)(const void *)(
| 0-1 | ||||||||||||||||||||||||||||||
3525 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3526 | ) == 1) && (__s1_len = __builtin_strlen (
| 0-1 | ||||||||||||||||||||||||||||||
3527 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3528 | ), __s1_len < 4) ? (__builtin_constant_p (
| 0-1 | ||||||||||||||||||||||||||||||
3529 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3530 | ) && ((size_t)(const void *)((
| 0-1 | ||||||||||||||||||||||||||||||
3531 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3532 | ) + 1) - (size_t)(const void *)(
| 0-1 | ||||||||||||||||||||||||||||||
3533 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3534 | ) == 1) ? __builtin_strcmp (
| 0-1 | ||||||||||||||||||||||||||||||
3535 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3536 | ,
| 0-1 | ||||||||||||||||||||||||||||||
3537 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3538 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0-1 | ||||||||||||||||||||||||||||||
3539 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3540 | ); int __result = (((const unsigned char *) (const char *) (
| 0-1 | ||||||||||||||||||||||||||||||
3541 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3542 | ))[0] - __s2[0]); if (__s1_len > 0
| 0-1 | ||||||||||||||||||||||||||||||
3543 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3544 | ))[1] - __s2[1]); if (__s1_len > 1
| 0-1 | ||||||||||||||||||||||||||||||
3545 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3546 | ))[2] - __s2[2]); if (__s1_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( "." ))[3] - __s2[3]);
| 0-1 | ||||||||||||||||||||||||||||||
3547 | "."
never executed: __result = (((const unsigned char *) (const char *) ( "." ))[3] - __s2[3]); | 0-1 | ||||||||||||||||||||||||||||||
3548 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( "." ))[3] - __s2[3]); never executed: }end of block executed 1 time by 1 test: __result; }))) : (__builtin_constant_p (end of block Executed by:
| 0-1 | ||||||||||||||||||||||||||||||
3549 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3550 | ) && ((size_t)(const void *)((
| 0-1 | ||||||||||||||||||||||||||||||
3551 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3552 | ) + 1) - (size_t)(const void *)(
| 0-1 | ||||||||||||||||||||||||||||||
3553 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3554 | ) == 1) && (__s2_len = __builtin_strlen (
| 0-1 | ||||||||||||||||||||||||||||||
3555 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3556 | ), __s2_len < 4) ? (__builtin_constant_p (
| 0-1 | ||||||||||||||||||||||||||||||
3557 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3558 | ) && ((size_t)(const void *)((
| 0-1 | ||||||||||||||||||||||||||||||
3559 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3560 | ) + 1) - (size_t)(const void *)(
| 0-1 | ||||||||||||||||||||||||||||||
3561 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3562 | ) == 1) ? __builtin_strcmp (
| 0-1 | ||||||||||||||||||||||||||||||
3563 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3564 | ,
| 0-1 | ||||||||||||||||||||||||||||||
3565 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3566 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0-1 | ||||||||||||||||||||||||||||||
3567 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3568 | ); int __result = (((const unsigned char *) (const char *) (
| 0-1 | ||||||||||||||||||||||||||||||
3569 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3570 | ))[0] - __s2[0]); if (__s2_len > 0
| 0-1 | ||||||||||||||||||||||||||||||
3571 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3572 | ))[1] - __s2[1]); if (__s2_len > 1
| 0-1 | ||||||||||||||||||||||||||||||
3573 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3574 | ))[2] - __s2[2]); if (__s2_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( dst_parent ))[3] - __s2[3]);
| 0-1 | ||||||||||||||||||||||||||||||
3575 | dst_parent
never executed: __result = (((const unsigned char *) (const char *) ( dst_parent ))[3] - __s2[3]); | 0-1 | ||||||||||||||||||||||||||||||
3576 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( dst_parent ))[3] - __s2[3]); never executed: }end of block never executed: __result; }))) : __builtin_strcmp (end of block
| 0-1 | ||||||||||||||||||||||||||||||
3577 | "."
| 0-1 | ||||||||||||||||||||||||||||||
3578 | ,
| 0-1 | ||||||||||||||||||||||||||||||
3579 | dst_parent
| 0-1 | ||||||||||||||||||||||||||||||
3580 | )))); })
| 0-1 | ||||||||||||||||||||||||||||||
3581 | == 0)
| 0-1 | ||||||||||||||||||||||||||||||
3582 | - | |||||||||||||||||||||||||||||||
3583 | - | |||||||||||||||||||||||||||||||
3584 | - | |||||||||||||||||||||||||||||||
3585 | || stat (".", &dot_sb) != 0
| 0 | ||||||||||||||||||||||||||||||
3586 | || stat (dst_parent, &dst_parent_sb) != 0
| 0 | ||||||||||||||||||||||||||||||
3587 | || ((
| 0 | ||||||||||||||||||||||||||||||
3588 | free (dst_parent); | - | ||||||||||||||||||||||||||||||
3589 | - | |||||||||||||||||||||||||||||||
3590 | if (! in_current_dir
| 0-1 | ||||||||||||||||||||||||||||||
3591 | { | - | ||||||||||||||||||||||||||||||
3592 | error (0, 0, | - | ||||||||||||||||||||||||||||||
3593 | - | |||||||||||||||||||||||||||||||
3594 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3595 | "%s: can make relative symbolic links only in current directory" | - | ||||||||||||||||||||||||||||||
3596 | , 5) | - | ||||||||||||||||||||||||||||||
3597 | , | - | ||||||||||||||||||||||||||||||
3598 | quotearg_n_style_colon (0, shell_escape_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3599 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3600 | } | - | ||||||||||||||||||||||||||||||
3601 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
3602 | if (force_symlinkat (src_name,
| 0-1 | ||||||||||||||||||||||||||||||
3603 | -100
| 0-1 | ||||||||||||||||||||||||||||||
3604 | , dst_name,
| 0-1 | ||||||||||||||||||||||||||||||
3605 | x->unlink_dest_after_failed_open)
| 0-1 | ||||||||||||||||||||||||||||||
3606 | < 0
| 0-1 | ||||||||||||||||||||||||||||||
3607 | { | - | ||||||||||||||||||||||||||||||
3608 | error (0, | - | ||||||||||||||||||||||||||||||
3609 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3610 | , | - | ||||||||||||||||||||||||||||||
3611 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3612 | "cannot create symbolic link %s to %s" | - | ||||||||||||||||||||||||||||||
3613 | , 5) | - | ||||||||||||||||||||||||||||||
3614 | , | - | ||||||||||||||||||||||||||||||
3615 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_name), quotearg_n_style (1, shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
3616 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3617 | } | - | ||||||||||||||||||||||||||||||
3618 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
3619 | else if (x->hard_link
| 4484-30034 | ||||||||||||||||||||||||||||||
3620 | && !(! 1 && | - | ||||||||||||||||||||||||||||||
3621 | (((( dead code: (((( src_mode )) & 0170000) == (0120000)) | - | ||||||||||||||||||||||||||||||
3622 | src_mode dead code: (((( src_mode )) & 0170000) == (0120000)) | - | ||||||||||||||||||||||||||||||
3623 | )) & 0170000) == (0120000)) dead code: (((( src_mode )) & 0170000) == (0120000)) | - | ||||||||||||||||||||||||||||||
3624 | - | |||||||||||||||||||||||||||||||
3625 | && x->dereference == DEREF_NEVER dead code: ))x->dereference == DEREF_NEVER | - | ||||||||||||||||||||||||||||||
3626 | { | - | ||||||||||||||||||||||||||||||
3627 | if (! create_hard_link (src_name, dst_name,
| 4-30030 | ||||||||||||||||||||||||||||||
3628 | x->unlink_dest_after_failed_open,
| 4-30030 | ||||||||||||||||||||||||||||||
3629 |
| 4-30030 | ||||||||||||||||||||||||||||||
3630 | 0
| 4-30030 | ||||||||||||||||||||||||||||||
3631 | , dereference)
| 4-30030 | ||||||||||||||||||||||||||||||
3632 | goto executed 4 times by 1 test: un_backup;goto un_backup; Executed by:
executed 4 times by 1 test: goto un_backup; Executed by:
| 4 | ||||||||||||||||||||||||||||||
3633 | } executed 30030 times by 1 test: end of block Executed by:
| 30030 | ||||||||||||||||||||||||||||||
3634 | else if ( | - | ||||||||||||||||||||||||||||||
3635 | ((((
| 26-4458 | ||||||||||||||||||||||||||||||
3636 | src_mode
| 26-4458 | ||||||||||||||||||||||||||||||
3637 | )) & 0170000) == (0100000))
| 26-4458 | ||||||||||||||||||||||||||||||
3638 | - | |||||||||||||||||||||||||||||||
3639 | || (x->copy_as_regular
| 4-15 | ||||||||||||||||||||||||||||||
3640 | ((((
| 4-11 | ||||||||||||||||||||||||||||||
3641 | src_mode
| 4-11 | ||||||||||||||||||||||||||||||
3642 | )) & 0170000) == (0120000))
| 4-11 | ||||||||||||||||||||||||||||||
3643 | )) | - | ||||||||||||||||||||||||||||||
3644 | { | - | ||||||||||||||||||||||||||||||
3645 | copied_as_regular = | - | ||||||||||||||||||||||||||||||
3646 | 1 | - | ||||||||||||||||||||||||||||||
3647 | ; | - | ||||||||||||||||||||||||||||||
3648 | if (! copy_reg (src_name, dst_name, x, dst_mode_bits &
| 4-4458 | ||||||||||||||||||||||||||||||
3649 | ((0400|0200|0100) | ((0400|0200|0100) >> 3) | (((0400|0200|0100) >> 3) >> 3))
| 4-4458 | ||||||||||||||||||||||||||||||
3650 | ,
| 4-4458 | ||||||||||||||||||||||||||||||
3651 | omitted_permissions, &new_dst, &src_sb)
| 4-4458 | ||||||||||||||||||||||||||||||
3652 | goto executed 4 times by 1 test: un_backup;goto un_backup; Executed by:
executed 4 times by 1 test: goto un_backup; Executed by:
| 4 | ||||||||||||||||||||||||||||||
3653 | } executed 4458 times by 3 tests: end of block Executed by:
| 4458 | ||||||||||||||||||||||||||||||
3654 | else if ( | - | ||||||||||||||||||||||||||||||
3655 | ((((
| 4-18 | ||||||||||||||||||||||||||||||
3656 | src_mode
| 4-18 | ||||||||||||||||||||||||||||||
3657 | )) & 0170000) == (0010000))
| 4-18 | ||||||||||||||||||||||||||||||
3658 | ) | - | ||||||||||||||||||||||||||||||
3659 | { | - | ||||||||||||||||||||||||||||||
3660 | - | |||||||||||||||||||||||||||||||
3661 | - | |||||||||||||||||||||||||||||||
3662 | - | |||||||||||||||||||||||||||||||
3663 | - | |||||||||||||||||||||||||||||||
3664 | if (mknod (dst_name, src_mode & ~omitted_permissions, 0) != 0
| 0-4 | ||||||||||||||||||||||||||||||
3665 | if (mkfifo (dst_name, src_mode & ~
| 0 | ||||||||||||||||||||||||||||||
3666 | 0010000
| 0 | ||||||||||||||||||||||||||||||
3667 | & ~omitted_permissions) != 0
| 0 | ||||||||||||||||||||||||||||||
3668 | { | - | ||||||||||||||||||||||||||||||
3669 | error (0, | - | ||||||||||||||||||||||||||||||
3670 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3671 | , | - | ||||||||||||||||||||||||||||||
3672 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3673 | "cannot create fifo %s" | - | ||||||||||||||||||||||||||||||
3674 | , 5) | - | ||||||||||||||||||||||||||||||
3675 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3676 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3677 | } | - | ||||||||||||||||||||||||||||||
3678 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
3679 | else if ( | - | ||||||||||||||||||||||||||||||
3680 | ((((
| 0-18 | ||||||||||||||||||||||||||||||
3681 | src_mode
| 0-18 | ||||||||||||||||||||||||||||||
3682 | )) & 0170000) == (0060000))
| 0-18 | ||||||||||||||||||||||||||||||
3683 | || | - | ||||||||||||||||||||||||||||||
3684 | ((((
| 0-18 | ||||||||||||||||||||||||||||||
3685 | src_mode
| 0-18 | ||||||||||||||||||||||||||||||
3686 | )) & 0170000) == (0020000))
| 0-18 | ||||||||||||||||||||||||||||||
3687 | || | - | ||||||||||||||||||||||||||||||
3688 | ((((
| 0-18 | ||||||||||||||||||||||||||||||
3689 | src_mode
| 0-18 | ||||||||||||||||||||||||||||||
3690 | )) & 0170000) == (0140000))
| 0-18 | ||||||||||||||||||||||||||||||
3691 | ) | - | ||||||||||||||||||||||||||||||
3692 | { | - | ||||||||||||||||||||||||||||||
3693 | if (mknod (dst_name, src_mode & ~omitted_permissions, src_sb.st_rdev)
| 0 | ||||||||||||||||||||||||||||||
3694 | != 0
| 0 | ||||||||||||||||||||||||||||||
3695 | { | - | ||||||||||||||||||||||||||||||
3696 | error (0, | - | ||||||||||||||||||||||||||||||
3697 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3698 | , | - | ||||||||||||||||||||||||||||||
3699 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3700 | "cannot create special file %s" | - | ||||||||||||||||||||||||||||||
3701 | , 5) | - | ||||||||||||||||||||||||||||||
3702 | , | - | ||||||||||||||||||||||||||||||
3703 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3704 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3705 | } | - | ||||||||||||||||||||||||||||||
3706 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3707 | else if ( | - | ||||||||||||||||||||||||||||||
3708 | ((((
| 0-18 | ||||||||||||||||||||||||||||||
3709 | src_mode
| 0-18 | ||||||||||||||||||||||||||||||
3710 | )) & 0170000) == (0120000))
| 0-18 | ||||||||||||||||||||||||||||||
3711 | ) | - | ||||||||||||||||||||||||||||||
3712 | { | - | ||||||||||||||||||||||||||||||
3713 | char *src_link_val = areadlink_with_size (src_name, src_sb.st_size); | - | ||||||||||||||||||||||||||||||
3714 | dest_is_symlink = | - | ||||||||||||||||||||||||||||||
3715 | 1 | - | ||||||||||||||||||||||||||||||
3716 | ; | - | ||||||||||||||||||||||||||||||
3717 | if (src_link_val ==
| 0-18 | ||||||||||||||||||||||||||||||
3718 | ((void *)0)
| 0-18 | ||||||||||||||||||||||||||||||
3719 | ) | - | ||||||||||||||||||||||||||||||
3720 | { | - | ||||||||||||||||||||||||||||||
3721 | error (0, | - | ||||||||||||||||||||||||||||||
3722 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3723 | , | - | ||||||||||||||||||||||||||||||
3724 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3725 | "cannot read symbolic link %s" | - | ||||||||||||||||||||||||||||||
3726 | , 5) | - | ||||||||||||||||||||||||||||||
3727 | , | - | ||||||||||||||||||||||||||||||
3728 | quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
3729 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3730 | } | - | ||||||||||||||||||||||||||||||
3731 | - | |||||||||||||||||||||||||||||||
3732 | int symlink_r = force_symlinkat (src_link_val, | - | ||||||||||||||||||||||||||||||
3733 | -100 | - | ||||||||||||||||||||||||||||||
3734 | , dst_name, | - | ||||||||||||||||||||||||||||||
3735 | x->unlink_dest_after_failed_open); | - | ||||||||||||||||||||||||||||||
3736 | int symlink_err = symlink_r < 0
| 0-18 | ||||||||||||||||||||||||||||||
3737 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3738 | : 0; | - | ||||||||||||||||||||||||||||||
3739 | if (symlink_err
| 0-18 | ||||||||||||||||||||||||||||||
3740 | ((((
| 0 | ||||||||||||||||||||||||||||||
3741 | dst_sb.st_mode
| 0 | ||||||||||||||||||||||||||||||
3742 | )) & 0170000) == (0120000))
| 0 | ||||||||||||||||||||||||||||||
3743 | - | |||||||||||||||||||||||||||||||
3744 | && dst_sb.st_size == strlen (src_link_val)
| 0 | ||||||||||||||||||||||||||||||
3745 | { | - | ||||||||||||||||||||||||||||||
3746 | - | |||||||||||||||||||||||||||||||
3747 | - | |||||||||||||||||||||||||||||||
3748 | - | |||||||||||||||||||||||||||||||
3749 | - | |||||||||||||||||||||||||||||||
3750 | char *dest_link_val = | - | ||||||||||||||||||||||||||||||
3751 | areadlink_with_size (dst_name, dst_sb.st_size); | - | ||||||||||||||||||||||||||||||
3752 | if (dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3753 | { | - | ||||||||||||||||||||||||||||||
3754 | if ((
| 0 | ||||||||||||||||||||||||||||||
3755 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||||||||
3756 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3757 | ) && __builtin_constant_p (
| 0 | ||||||||||||||||||||||||||||||
3758 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3759 | ) && (__s1_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||||||||
3760 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3761 | ), __s2_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||||||||
3762 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3763 | ), (!((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||||||||
3764 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3765 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||||||||
3766 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3767 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||||||||
3768 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3769 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||||||||
3770 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3771 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
| 0 | ||||||||||||||||||||||||||||||
3772 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3773 | ,
| 0 | ||||||||||||||||||||||||||||||
3774 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3775 | ) : (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||||||||
3776 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3777 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||||||||
3778 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3779 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||||||||
3780 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3781 | ) == 1) && (__s1_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||||||||
3782 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3783 | ), __s1_len < 4) ? (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||||||||
3784 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3785 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||||||||
3786 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3787 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||||||||
3788 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3789 | ) == 1) ? __builtin_strcmp (
| 0 | ||||||||||||||||||||||||||||||
3790 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3791 | ,
| 0 | ||||||||||||||||||||||||||||||
3792 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3793 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||||||||
3794 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3795 | ); int __result = (((const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||||||||
3796 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3797 | ))[0] - __s2[0]); if (__s1_len > 0
| 0 | ||||||||||||||||||||||||||||||
3798 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3799 | ))[1] - __s2[1]); if (__s1_len > 1
| 0 | ||||||||||||||||||||||||||||||
3800 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3801 | ))[2] - __s2[2]); if (__s1_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( dest_link_val ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||||||||
3802 | dest_link_val
never executed: __result = (((const unsigned char *) (const char *) ( dest_link_val ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||||||||
3803 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||||||||
3804 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3805 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||||||||
3806 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3807 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||||||||
3808 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3809 | ) == 1) && (__s2_len = __builtin_strlen (
| 0 | ||||||||||||||||||||||||||||||
3810 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3811 | ), __s2_len < 4) ? (__builtin_constant_p (
| 0 | ||||||||||||||||||||||||||||||
3812 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3813 | ) && ((size_t)(const void *)((
| 0 | ||||||||||||||||||||||||||||||
3814 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3815 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||||||||||||||
3816 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3817 | ) == 1) ? __builtin_strcmp (
| 0 | ||||||||||||||||||||||||||||||
3818 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3819 | ,
| 0 | ||||||||||||||||||||||||||||||
3820 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3821 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||||||||
3822 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3823 | ); int __result = (((const unsigned char *) (const char *) (
| 0 | ||||||||||||||||||||||||||||||
3824 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3825 | ))[0] - __s2[0]); if (__s2_len > 0
| 0 | ||||||||||||||||||||||||||||||
3826 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3827 | ))[1] - __s2[1]); if (__s2_len > 1
| 0 | ||||||||||||||||||||||||||||||
3828 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3829 | ))[2] - __s2[2]); if (__s2_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( src_link_val ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||||||||
3830 | src_link_val
never executed: __result = (((const unsigned char *) (const char *) ( src_link_val ))[3] - __s2[3]); | 0 | ||||||||||||||||||||||||||||||
3831 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
| 0 | ||||||||||||||||||||||||||||||
3832 | dest_link_val
| 0 | ||||||||||||||||||||||||||||||
3833 | ,
| 0 | ||||||||||||||||||||||||||||||
3834 | src_link_val
| 0 | ||||||||||||||||||||||||||||||
3835 | )))); })
| 0 | ||||||||||||||||||||||||||||||
3836 | == 0)
| 0 | ||||||||||||||||||||||||||||||
3837 | symlink_err = 0; never executed: symlink_err = 0; | 0 | ||||||||||||||||||||||||||||||
3838 | free (dest_link_val); | - | ||||||||||||||||||||||||||||||
3839 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3840 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3841 | free (src_link_val); | - | ||||||||||||||||||||||||||||||
3842 | if (symlink_err
| 0-18 | ||||||||||||||||||||||||||||||
3843 | { | - | ||||||||||||||||||||||||||||||
3844 | error (0, symlink_err, | - | ||||||||||||||||||||||||||||||
3845 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3846 | "cannot create symbolic link %s" | - | ||||||||||||||||||||||||||||||
3847 | , 5) | - | ||||||||||||||||||||||||||||||
3848 | , | - | ||||||||||||||||||||||||||||||
3849 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3850 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3851 | } | - | ||||||||||||||||||||||||||||||
3852 | - | |||||||||||||||||||||||||||||||
3853 | if (x->preserve_security_context
| 0-18 | ||||||||||||||||||||||||||||||
3854 | restore_default_fscreatecon_or_die (); never executed: restore_default_fscreatecon_or_die (); | 0 | ||||||||||||||||||||||||||||||
3855 | - | |||||||||||||||||||||||||||||||
3856 | if (x->preserve_ownership
| 3-15 | ||||||||||||||||||||||||||||||
3857 | { | - | ||||||||||||||||||||||||||||||
3858 | - | |||||||||||||||||||||||||||||||
3859 | - | |||||||||||||||||||||||||||||||
3860 | if (1 | - | ||||||||||||||||||||||||||||||
3861 | && lchown (dst_name, src_sb.st_uid, src_sb.st_gid) != 0
| 0-3 | ||||||||||||||||||||||||||||||
3862 | && ! chown_failure_ok (x)
| 0 | ||||||||||||||||||||||||||||||
3863 | { | - | ||||||||||||||||||||||||||||||
3864 | error (0, | - | ||||||||||||||||||||||||||||||
3865 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3866 | , | - | ||||||||||||||||||||||||||||||
3867 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3868 | "failed to preserve ownership for %s" | - | ||||||||||||||||||||||||||||||
3869 | , 5) | - | ||||||||||||||||||||||||||||||
3870 | , | - | ||||||||||||||||||||||||||||||
3871 | dst_name); | - | ||||||||||||||||||||||||||||||
3872 | if (x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
3873 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3874 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3875 | else | - | ||||||||||||||||||||||||||||||
3876 | { | - | ||||||||||||||||||||||||||||||
3877 | - | |||||||||||||||||||||||||||||||
3878 | - | |||||||||||||||||||||||||||||||
3879 | - | |||||||||||||||||||||||||||||||
3880 | - | |||||||||||||||||||||||||||||||
3881 | } executed 3 times by 2 tests: end of block Executed by:
| 3 | ||||||||||||||||||||||||||||||
3882 | } | - | ||||||||||||||||||||||||||||||
3883 | } executed 18 times by 2 tests: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
3884 | else | - | ||||||||||||||||||||||||||||||
3885 | { | - | ||||||||||||||||||||||||||||||
3886 | error (0, 0, | - | ||||||||||||||||||||||||||||||
3887 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3888 | "%s has unknown file type" | - | ||||||||||||||||||||||||||||||
3889 | , 5) | - | ||||||||||||||||||||||||||||||
3890 | , quotearg_style (shell_escape_always_quoting_style, src_name)); | - | ||||||||||||||||||||||||||||||
3891 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3892 | } | - | ||||||||||||||||||||||||||||||
3893 | - | |||||||||||||||||||||||||||||||
3894 | - | |||||||||||||||||||||||||||||||
3895 | - | |||||||||||||||||||||||||||||||
3896 | if (!new_dst
| 0-68370 | ||||||||||||||||||||||||||||||
3897 | ((((
| 0-15 | ||||||||||||||||||||||||||||||
3898 | src_mode
| 0-15 | ||||||||||||||||||||||||||||||
3899 | )) & 0170000) == (0040000))
| 0-15 | ||||||||||||||||||||||||||||||
3900 | - | |||||||||||||||||||||||||||||||
3901 | && (x->set_security_context
| 0 | ||||||||||||||||||||||||||||||
3902 | { | - | ||||||||||||||||||||||||||||||
3903 | if (! set_file_security_ctx (dst_name, x->preserve_security_context,
| 0 | ||||||||||||||||||||||||||||||
3904 |
| 0 | ||||||||||||||||||||||||||||||
3905 | 0
| 0 | ||||||||||||||||||||||||||||||
3906 | , x)
| 0 | ||||||||||||||||||||||||||||||
3907 | { | - | ||||||||||||||||||||||||||||||
3908 | if (x->require_preserve_context
| 0 | ||||||||||||||||||||||||||||||
3909 | goto never executed: un_backup;goto un_backup; never executed: goto un_backup; | 0 | ||||||||||||||||||||||||||||||
3910 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3911 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3912 | - | |||||||||||||||||||||||||||||||
3913 | if (command_line_arg
| 601-63938 | ||||||||||||||||||||||||||||||
3914 | { | - | ||||||||||||||||||||||||||||||
3915 | - | |||||||||||||||||||||||||||||||
3916 | - | |||||||||||||||||||||||||||||||
3917 | struct stat sb; | - | ||||||||||||||||||||||||||||||
3918 | if (lstat (dst_name, &sb) == 0
| 0-3943 | ||||||||||||||||||||||||||||||
3919 | record_file (x->dest_info, dst_name, &sb); executed 3943 times by 3 tests: record_file (x->dest_info, dst_name, &sb); Executed by:
| 3943 | ||||||||||||||||||||||||||||||
3920 | } executed 3943 times by 3 tests: end of block Executed by:
| 3943 | ||||||||||||||||||||||||||||||
3921 | - | |||||||||||||||||||||||||||||||
3922 | - | |||||||||||||||||||||||||||||||
3923 | - | |||||||||||||||||||||||||||||||
3924 | if (x->hard_link
| 8434-60048 | ||||||||||||||||||||||||||||||
3925 | ((((
| 30018-30030 | ||||||||||||||||||||||||||||||
3926 | src_mode
| 30018-30030 | ||||||||||||||||||||||||||||||
3927 | )) & 0170000) == (0040000))
| 30018-30030 | ||||||||||||||||||||||||||||||
3928 | - | |||||||||||||||||||||||||||||||
3929 | && !(! 1 && | - | ||||||||||||||||||||||||||||||
3930 | (((( dead code: (((( src_mode )) & 0170000) == (0120000)) | - | ||||||||||||||||||||||||||||||
3931 | src_mode dead code: (((( src_mode )) & 0170000) == (0120000)) | - | ||||||||||||||||||||||||||||||
3932 | )) & 0170000) == (0120000)) dead code: (((( src_mode )) & 0170000) == (0120000)) | - | ||||||||||||||||||||||||||||||
3933 | - | |||||||||||||||||||||||||||||||
3934 | && x->dereference == DEREF_NEVER dead code: ))x->dereference == DEREF_NEVER | - | ||||||||||||||||||||||||||||||
3935 | return executed 30030 times by 1 test: delayed_ok;return delayed_ok; Executed by:
executed 30030 times by 1 test: return delayed_ok; Executed by:
| 30030 | ||||||||||||||||||||||||||||||
3936 | - | |||||||||||||||||||||||||||||||
3937 | if (copied_as_regular
| 4458-33994 | ||||||||||||||||||||||||||||||
3938 | return executed 4458 times by 3 tests: delayed_ok;return delayed_ok; Executed by:
executed 4458 times by 3 tests: return delayed_ok; Executed by:
| 4458 | ||||||||||||||||||||||||||||||
3939 | if (x->preserve_timestamps
| 55-33939 | ||||||||||||||||||||||||||||||
3940 | { | - | ||||||||||||||||||||||||||||||
3941 | struct timespec timespec[2]; | - | ||||||||||||||||||||||||||||||
3942 | timespec[0] = get_stat_atime (&src_sb); | - | ||||||||||||||||||||||||||||||
3943 | timespec[1] = get_stat_mtime (&src_sb); | - | ||||||||||||||||||||||||||||||
3944 | - | |||||||||||||||||||||||||||||||
3945 | if ((
| 0-33939 | ||||||||||||||||||||||||||||||
3946 | ? utimens_symlink (dst_name, timespec)
| 0-33939 | ||||||||||||||||||||||||||||||
3947 | : utimens (dst_name, timespec))
| 0-33939 | ||||||||||||||||||||||||||||||
3948 | != 0
| 0-33939 | ||||||||||||||||||||||||||||||
3949 | { | - | ||||||||||||||||||||||||||||||
3950 | error (0, | - | ||||||||||||||||||||||||||||||
3951 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
3952 | , | - | ||||||||||||||||||||||||||||||
3953 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
3954 | "preserving times for %s" | - | ||||||||||||||||||||||||||||||
3955 | , 5) | - | ||||||||||||||||||||||||||||||
3956 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
3957 | if (x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
3958 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3959 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3960 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3961 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
3962 | } executed 33939 times by 2 tests: end of block Executed by:
| 33939 | ||||||||||||||||||||||||||||||
3963 | - | |||||||||||||||||||||||||||||||
3964 | - | |||||||||||||||||||||||||||||||
3965 | if (!dest_is_symlink
| 19-33975 | ||||||||||||||||||||||||||||||
3966 | && (new_dst
| 0-33933 | ||||||||||||||||||||||||||||||
3967 | { | - | ||||||||||||||||||||||||||||||
3968 | switch (set_owner (x, dst_name, -1, &src_sb, new_dst, &dst_sb)) | - | ||||||||||||||||||||||||||||||
3969 | { | - | ||||||||||||||||||||||||||||||
3970 | case never executed: -1:case -1: never executed: case -1: | 0 | ||||||||||||||||||||||||||||||
3971 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3972 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3973 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3974 | - | |||||||||||||||||||||||||||||||
3975 | case never executed: 0:case 0: never executed: case 0: | 0 | ||||||||||||||||||||||||||||||
3976 | src_mode &= ~ ( | - | ||||||||||||||||||||||||||||||
3977 | 04000 | - | ||||||||||||||||||||||||||||||
3978 | | | - | ||||||||||||||||||||||||||||||
3979 | 02000 | - | ||||||||||||||||||||||||||||||
3980 | | | - | ||||||||||||||||||||||||||||||
3981 | 01000 | - | ||||||||||||||||||||||||||||||
3982 | ); | - | ||||||||||||||||||||||||||||||
3983 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
3984 | } | - | ||||||||||||||||||||||||||||||
3985 | } executed 33933 times by 2 tests: end of block Executed by:
| 33933 | ||||||||||||||||||||||||||||||
3986 | - | |||||||||||||||||||||||||||||||
3987 | - | |||||||||||||||||||||||||||||||
3988 | if (x->preserve_xattr
| 0-33936 | ||||||||||||||||||||||||||||||
3989 | && x->require_preserve_xattr
| 0 | ||||||||||||||||||||||||||||||
3990 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3991 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3992 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
3993 | - | |||||||||||||||||||||||||||||||
3994 | - | |||||||||||||||||||||||||||||||
3995 | if (dest_is_symlink
| 19-33975 | ||||||||||||||||||||||||||||||
3996 | return executed 19 times by 2 tests: delayed_ok;return delayed_ok; Executed by:
executed 19 times by 2 tests: return delayed_ok; Executed by:
| 19 | ||||||||||||||||||||||||||||||
3997 | - | |||||||||||||||||||||||||||||||
3998 | set_author (dst_name, -1, &src_sb); | - | ||||||||||||||||||||||||||||||
3999 | - | |||||||||||||||||||||||||||||||
4000 | if (x->preserve_mode
| 0-33936 | ||||||||||||||||||||||||||||||
4001 | { | - | ||||||||||||||||||||||||||||||
4002 | if (copy_acl (src_name, -1, dst_name, -1, src_mode) != 0
| 0-33936 | ||||||||||||||||||||||||||||||
4003 | && x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
4004 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4005 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4006 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4007 | } executed 33936 times by 2 tests: end of block Executed by:
| 33936 | ||||||||||||||||||||||||||||||
4008 | else if (x->set_mode
| 0-39 | ||||||||||||||||||||||||||||||
4009 | { | - | ||||||||||||||||||||||||||||||
4010 | if (set_acl (dst_name, -1, x->mode) != 0
| 0 | ||||||||||||||||||||||||||||||
4011 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4012 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4013 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4014 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
4015 | else if (x->explicit_no_preserve_mode
| 2-37 | ||||||||||||||||||||||||||||||
4016 | { | - | ||||||||||||||||||||||||||||||
4017 | int default_permissions = | - | ||||||||||||||||||||||||||||||
4018 | ((((
| 1 | ||||||||||||||||||||||||||||||
4019 | src_mode
| 1 | ||||||||||||||||||||||||||||||
4020 | )) & 0170000) == (0040000))
| 1 | ||||||||||||||||||||||||||||||
4021 | || | - | ||||||||||||||||||||||||||||||
4022 | ((((
| 0-1 | ||||||||||||||||||||||||||||||
4023 | src_mode
| 0-1 | ||||||||||||||||||||||||||||||
4024 | )) & 0170000) == (0140000))
| 0-1 | ||||||||||||||||||||||||||||||
4025 | - | |||||||||||||||||||||||||||||||
4026 | ? | - | ||||||||||||||||||||||||||||||
4027 | ((0400|0200|0100) | ((0400|0200|0100) >> 3) | (((0400|0200|0100) >> 3) >> 3)) | - | ||||||||||||||||||||||||||||||
4028 | : ( | - | ||||||||||||||||||||||||||||||
4029 | 0400 | - | ||||||||||||||||||||||||||||||
4030 | | | - | ||||||||||||||||||||||||||||||
4031 | 0200 | - | ||||||||||||||||||||||||||||||
4032 | | | - | ||||||||||||||||||||||||||||||
4033 | (0400 >> 3) | - | ||||||||||||||||||||||||||||||
4034 | | | - | ||||||||||||||||||||||||||||||
4035 | (0200 >> 3) | - | ||||||||||||||||||||||||||||||
4036 | | | - | ||||||||||||||||||||||||||||||
4037 | ((0400 >> 3) >> 3) | - | ||||||||||||||||||||||||||||||
4038 | | | - | ||||||||||||||||||||||||||||||
4039 | ((0200 >> 3) >> 3) | - | ||||||||||||||||||||||||||||||
4040 | ); | - | ||||||||||||||||||||||||||||||
4041 | if (set_acl (dst_name, -1, default_permissions & ~cached_umask ()) != 0
| 0-2 | ||||||||||||||||||||||||||||||
4042 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4043 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4044 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4045 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
4046 | else | - | ||||||||||||||||||||||||||||||
4047 | { | - | ||||||||||||||||||||||||||||||
4048 | if (omitted_permissions
| 1-36 | ||||||||||||||||||||||||||||||
4049 | { | - | ||||||||||||||||||||||||||||||
4050 | omitted_permissions &= ~ cached_umask (); | - | ||||||||||||||||||||||||||||||
4051 | - | |||||||||||||||||||||||||||||||
4052 | if (omitted_permissions
| 0-1 | ||||||||||||||||||||||||||||||
4053 | { | - | ||||||||||||||||||||||||||||||
4054 | - | |||||||||||||||||||||||||||||||
4055 | - | |||||||||||||||||||||||||||||||
4056 | - | |||||||||||||||||||||||||||||||
4057 | - | |||||||||||||||||||||||||||||||
4058 | - | |||||||||||||||||||||||||||||||
4059 | - | |||||||||||||||||||||||||||||||
4060 | if (new_dst
| 0-1 | ||||||||||||||||||||||||||||||
4061 | { | - | ||||||||||||||||||||||||||||||
4062 | error (0, | - | ||||||||||||||||||||||||||||||
4063 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
4064 | , | - | ||||||||||||||||||||||||||||||
4065 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
4066 | "cannot stat %s" | - | ||||||||||||||||||||||||||||||
4067 | , 5) | - | ||||||||||||||||||||||||||||||
4068 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
4069 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4070 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4071 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4072 | } | - | ||||||||||||||||||||||||||||||
4073 | dst_mode = dst_sb.st_mode; | - | ||||||||||||||||||||||||||||||
4074 | if (omitted_permissions & ~dst_mode
| 0-1 | ||||||||||||||||||||||||||||||
4075 | restore_dst_mode = executed 1 time by 1 test: restore_dst_mode = 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
4076 | 1 executed 1 time by 1 test: restore_dst_mode = 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
4077 | ; executed 1 time by 1 test: restore_dst_mode = 1 ; Executed by:
| 1 | ||||||||||||||||||||||||||||||
4078 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
4079 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
4080 | - | |||||||||||||||||||||||||||||||
4081 | if (restore_dst_mode
| 1-36 | ||||||||||||||||||||||||||||||
4082 | { | - | ||||||||||||||||||||||||||||||
4083 | if ( | - | ||||||||||||||||||||||||||||||
4084 | chmod
| 0-1 | ||||||||||||||||||||||||||||||
4085 | (dst_name, dst_mode | omitted_permissions) != 0
| 0-1 | ||||||||||||||||||||||||||||||
4086 | { | - | ||||||||||||||||||||||||||||||
4087 | error (0, | - | ||||||||||||||||||||||||||||||
4088 | (*__errno_location ()) | - | ||||||||||||||||||||||||||||||
4089 | , | - | ||||||||||||||||||||||||||||||
4090 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||
4091 | "preserving permissions for %s" | - | ||||||||||||||||||||||||||||||
4092 | , 5) | - | ||||||||||||||||||||||||||||||
4093 | , | - | ||||||||||||||||||||||||||||||
4094 | quotearg_style (shell_escape_always_quoting_style, dst_name)); | - | ||||||||||||||||||||||||||||||
4095 | if (x->require_preserve
| 0 | ||||||||||||||||||||||||||||||
4096 | return never executed: return 0 ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4097 | 0 never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4098 | ; never executed: return 0 ; | 0 | ||||||||||||||||||||||||||||||
4099 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
4100 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
4101 | } executed 37 times by 1 test: end of block Executed by:
| 37 | ||||||||||||||||||||||||||||||
4102 | - | |||||||||||||||||||||||||||||||
4103 | return executed 33975 times by 2 tests: delayed_ok;return delayed_ok; Executed by:
executed 33975 times by 2 tests: return delayed_ok; Executed by:
| 33975 | ||||||||||||||||||||||||||||||
4104 | - | |||||||||||||||||||||||||||||||
4105 | un_backup: | - | ||||||||||||||||||||||||||||||
4106 | - | |||||||||||||||||||||||||||||||
4107 | if (x->preserve_security_context
| 0-14 | ||||||||||||||||||||||||||||||
4108 | restore_default_fscreatecon_or_die (); never executed: restore_default_fscreatecon_or_die (); | 0 | ||||||||||||||||||||||||||||||
4109 | - | |||||||||||||||||||||||||||||||
4110 | - | |||||||||||||||||||||||||||||||
4111 | - | |||||||||||||||||||||||||||||||
4112 | - | |||||||||||||||||||||||||||||||
4113 | - | |||||||||||||||||||||||||||||||
4114 | - | |||||||||||||||||||||||||||||||
4115 | - | |||||||||||||||||||||||||||||||
4116 | if (earlier_file ==
| 6-8 | ||||||||||||||||||||||||||||||
4117 | ((void *)0)
| 6-8 | ||||||||||||||||||||||||||||||
4118 | ) | - | ||||||||||||||||||||||||||||||
4119 | forget_created (src_sb.st_ino, src_sb.st_dev); executed 8 times by 1 test: forget_created (src_sb.st_ino, src_sb.st_dev); Executed by:
| 8 | ||||||||||||||||||||||||||||||
4120 | - | |||||||||||||||||||||||||||||||
4121 | if (dst_backup
| 0-14 | ||||||||||||||||||||||||||||||
4122 | { | - | ||||||||||||||||||||||||||||||
4123 | if (rename (dst_backup, dst_name) != 0
| 0 | ||||||||||||||||||||||||||||||
4124 | error (0, never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "cannot un-backup %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4125 | (*__errno_location ()) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "cannot un-backup %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4126 | , never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "cannot un-backup %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4127 | dcgettext (((void *)0), never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "cannot un-backup %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4128 | "cannot un-backup %s" never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "cannot un-backup %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4129 | , 5) never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "cannot un-backup %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4130 | , quotearg_style (shell_escape_always_quoting_style, dst_name)); never executed: error (0, (*__errno_location ()) , dcgettext (((void *)0), "cannot un-backup %s" , 5) , quotearg_style (shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4131 | else | - | ||||||||||||||||||||||||||||||
4132 | { | - | ||||||||||||||||||||||||||||||
4133 | if (x->verbose
| 0 | ||||||||||||||||||||||||||||||
4134 | printf ( never executed: printf ( dcgettext (((void *)0), "%s -> %s (unbackup)\n" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_backup), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4135 | dcgettext (((void *)0), never executed: printf ( dcgettext (((void *)0), "%s -> %s (unbackup)\n" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_backup), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4136 | "%s -> %s (unbackup)\n" never executed: printf ( dcgettext (((void *)0), "%s -> %s (unbackup)\n" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_backup), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4137 | , 5) never executed: printf ( dcgettext (((void *)0), "%s -> %s (unbackup)\n" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_backup), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4138 | , never executed: printf ( dcgettext (((void *)0), "%s -> %s (unbackup)\n" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_backup), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4139 | quotearg_n_style (0, shell_escape_always_quoting_style, dst_backup), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); never executed: printf ( dcgettext (((void *)0), "%s -> %s (unbackup)\n" , 5) , quotearg_n_style (0, shell_escape_always_quoting_style, dst_backup), quotearg_n_style (1, shell_escape_always_quoting_style, dst_name)); | 0 | ||||||||||||||||||||||||||||||
4140 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
4141 | } | - | ||||||||||||||||||||||||||||||
4142 | return executed 14 times by 1 test: return 0 ; Executed by:
executed 14 times by 1 test: return 0 ; Executed by:
| 14 | ||||||||||||||||||||||||||||||
4143 | 0 executed 14 times by 1 test: return 0 ; Executed by:
| 14 | ||||||||||||||||||||||||||||||
4144 | ; executed 14 times by 1 test: return 0 ; Executed by:
| 14 | ||||||||||||||||||||||||||||||
4145 | } | - | ||||||||||||||||||||||||||||||
4146 | - | |||||||||||||||||||||||||||||||
4147 | static | - | ||||||||||||||||||||||||||||||
4148 | _Bool | - | ||||||||||||||||||||||||||||||
4149 | __attribute__ ((__pure__)) | - | ||||||||||||||||||||||||||||||
4150 | valid_options (const struct cp_options *co) | - | ||||||||||||||||||||||||||||||
4151 | { | - | ||||||||||||||||||||||||||||||
4152 | - | |||||||||||||||||||||||||||||||
4153 | (( | - | ||||||||||||||||||||||||||||||
4154 | co != | - | ||||||||||||||||||||||||||||||
4155 | ((void *)0)) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
4156 | "co != NULL" | - | ||||||||||||||||||||||||||||||
4157 | , "src/copy.c", 2941, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
4158 | ; | - | ||||||||||||||||||||||||||||||
4159 | - | |||||||||||||||||||||||||||||||
4160 | (( | - | ||||||||||||||||||||||||||||||
4161 | ((unsigned int) (co->backup_type) <= numbered_backups) | - | ||||||||||||||||||||||||||||||
4162 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
4163 | "VALID_BACKUP_TYPE (co->backup_type)" | - | ||||||||||||||||||||||||||||||
4164 | , "src/copy.c", 2942, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
4165 | ; | - | ||||||||||||||||||||||||||||||
4166 | - | |||||||||||||||||||||||||||||||
4167 | (( | - | ||||||||||||||||||||||||||||||
4168 | ((co->sparse_mode) == SPARSE_NEVER || (co->sparse_mode) == SPARSE_AUTO || (co->sparse_mode) == SPARSE_ALWAYS) | - | ||||||||||||||||||||||||||||||
4169 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
4170 | "VALID_SPARSE_MODE (co->sparse_mode)" | - | ||||||||||||||||||||||||||||||
4171 | , "src/copy.c", 2943, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
4172 | ; | - | ||||||||||||||||||||||||||||||
4173 | - | |||||||||||||||||||||||||||||||
4174 | (( | - | ||||||||||||||||||||||||||||||
4175 | ((co->reflink_mode) == REFLINK_NEVER || (co->reflink_mode) == REFLINK_AUTO || (co->reflink_mode) == REFLINK_ALWAYS) | - | ||||||||||||||||||||||||||||||
4176 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
4177 | "VALID_REFLINK_MODE (co->reflink_mode)" | - | ||||||||||||||||||||||||||||||
4178 | , "src/copy.c", 2944, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
4179 | ; | - | ||||||||||||||||||||||||||||||
4180 | - | |||||||||||||||||||||||||||||||
4181 | (( | - | ||||||||||||||||||||||||||||||
4182 | !(co->hard_link && co->symbolic_link) | - | ||||||||||||||||||||||||||||||
4183 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
4184 | "!(co->hard_link && co->symbolic_link)" | - | ||||||||||||||||||||||||||||||
4185 | , "src/copy.c", 2945, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
4186 | ; | - | ||||||||||||||||||||||||||||||
4187 | - | |||||||||||||||||||||||||||||||
4188 | (( | - | ||||||||||||||||||||||||||||||
4189 | ! (co->reflink_mode == REFLINK_ALWAYS && co->sparse_mode != SPARSE_AUTO) | - | ||||||||||||||||||||||||||||||
4190 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
4191 | "! (co->reflink_mode == REFLINK_ALWAYS && co->sparse_mode != SPARSE_AUTO)" | - | ||||||||||||||||||||||||||||||
4192 | , | - | ||||||||||||||||||||||||||||||
4193 | - | |||||||||||||||||||||||||||||||
4194 | "src/copy.c" | - | ||||||||||||||||||||||||||||||
4195 | , | - | ||||||||||||||||||||||||||||||
4196 | - | |||||||||||||||||||||||||||||||
4197 | 2948 | - | ||||||||||||||||||||||||||||||
4198 | , __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
4199 | - | |||||||||||||||||||||||||||||||
4200 | - | |||||||||||||||||||||||||||||||
4201 | ; | - | ||||||||||||||||||||||||||||||
4202 | return executed 5273 times by 3 tests: return 1 ; Executed by:
executed 5273 times by 3 tests: return 1 ; Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4203 | 1 executed 5273 times by 3 tests: return 1 ; Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4204 | ; executed 5273 times by 3 tests: return 1 ; Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4205 | } | - | ||||||||||||||||||||||||||||||
4206 | extern | - | ||||||||||||||||||||||||||||||
4207 | _Bool | - | ||||||||||||||||||||||||||||||
4208 | - | |||||||||||||||||||||||||||||||
4209 | copy (char const *src_name, char const *dst_name, | - | ||||||||||||||||||||||||||||||
4210 | - | |||||||||||||||||||||||||||||||
4211 | _Bool | - | ||||||||||||||||||||||||||||||
4212 | nonexistent_dst, const struct cp_options *options, | - | ||||||||||||||||||||||||||||||
4213 | - | |||||||||||||||||||||||||||||||
4214 | _Bool | - | ||||||||||||||||||||||||||||||
4215 | *copy_into_self, | - | ||||||||||||||||||||||||||||||
4216 | _Bool | - | ||||||||||||||||||||||||||||||
4217 | *rename_succeeded) | - | ||||||||||||||||||||||||||||||
4218 | { | - | ||||||||||||||||||||||||||||||
4219 | - | |||||||||||||||||||||||||||||||
4220 | (( | - | ||||||||||||||||||||||||||||||
4221 | valid_options (options) | - | ||||||||||||||||||||||||||||||
4222 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||||||||||||||
4223 | "valid_options (options)" | - | ||||||||||||||||||||||||||||||
4224 | , "src/copy.c", 2966, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||||||||||||||
4225 | ; | - | ||||||||||||||||||||||||||||||
4226 | top_level_src_name = src_name; | - | ||||||||||||||||||||||||||||||
4227 | top_level_dst_name = dst_name; | - | ||||||||||||||||||||||||||||||
4228 | - | |||||||||||||||||||||||||||||||
4229 | - | |||||||||||||||||||||||||||||||
4230 | _Bool | - | ||||||||||||||||||||||||||||||
4231 | first_dir_created_per_command_line_arg = | - | ||||||||||||||||||||||||||||||
4232 | 0 | - | ||||||||||||||||||||||||||||||
4233 | ; | - | ||||||||||||||||||||||||||||||
4234 | return executed 5273 times by 3 tests: copy_internal (src_name, dst_name, nonexistent_dst, return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4235 | ((void *)0) executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4236 | , executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4237 | ((void *)0) executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4238 | , executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4239 | options, executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4240 | 1 executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4241 | , executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4242 | &first_dir_created_per_command_line_arg, executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4243 | copy_into_self, rename_succeeded); executed 5273 times by 3 tests: return copy_internal (src_name, dst_name, nonexistent_dst, ((void *)0) , ((void *)0) , options, 1 , &first_dir_created_per_command_line_arg, copy_into_self, rename_succeeded); Executed by:
| 5273 | ||||||||||||||||||||||||||||||
4244 | } | - | ||||||||||||||||||||||||||||||
4245 | - | |||||||||||||||||||||||||||||||
4246 | - | |||||||||||||||||||||||||||||||
4247 | - | |||||||||||||||||||||||||||||||
4248 | extern void | - | ||||||||||||||||||||||||||||||
4249 | cp_options_default (struct cp_options *x) | - | ||||||||||||||||||||||||||||||
4250 | { | - | ||||||||||||||||||||||||||||||
4251 | memset (x, 0, sizeof *x); | - | ||||||||||||||||||||||||||||||
4252 | x->chown_privileges = x->owner_privileges = (geteuid () == 0); | - | ||||||||||||||||||||||||||||||
4253 | - | |||||||||||||||||||||||||||||||
4254 | x->rename_errno = -1; | - | ||||||||||||||||||||||||||||||
4255 | } executed 1606 times by 3 tests: end of block Executed by:
| 1606 | ||||||||||||||||||||||||||||||
4256 | - | |||||||||||||||||||||||||||||||
4257 | - | |||||||||||||||||||||||||||||||
4258 | - | |||||||||||||||||||||||||||||||
4259 | - | |||||||||||||||||||||||||||||||
4260 | - | |||||||||||||||||||||||||||||||
4261 | extern | - | ||||||||||||||||||||||||||||||
4262 | _Bool | - | ||||||||||||||||||||||||||||||
4263 | - | |||||||||||||||||||||||||||||||
4264 | chown_failure_ok (struct cp_options const *x) | - | ||||||||||||||||||||||||||||||
4265 | { | - | ||||||||||||||||||||||||||||||
4266 | - | |||||||||||||||||||||||||||||||
4267 | - | |||||||||||||||||||||||||||||||
4268 | - | |||||||||||||||||||||||||||||||
4269 | - | |||||||||||||||||||||||||||||||
4270 | return never executed: ((return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4271 | (*__errno_location ()) never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4272 | == never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4273 | 1 never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4274 | || never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4275 | (*__errno_location ()) never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4276 | == never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4277 | 22 never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4278 | ) && !x->chown_privileges); never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->chown_privileges); | 0 | ||||||||||||||||||||||||||||||
4279 | } | - | ||||||||||||||||||||||||||||||
4280 | - | |||||||||||||||||||||||||||||||
4281 | - | |||||||||||||||||||||||||||||||
4282 | - | |||||||||||||||||||||||||||||||
4283 | - | |||||||||||||||||||||||||||||||
4284 | - | |||||||||||||||||||||||||||||||
4285 | static | - | ||||||||||||||||||||||||||||||
4286 | _Bool | - | ||||||||||||||||||||||||||||||
4287 | - | |||||||||||||||||||||||||||||||
4288 | owner_failure_ok (struct cp_options const *x) | - | ||||||||||||||||||||||||||||||
4289 | { | - | ||||||||||||||||||||||||||||||
4290 | return never executed: ((return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4291 | (*__errno_location ()) never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4292 | == never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4293 | 1 never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4294 | || never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4295 | (*__errno_location ()) never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4296 | == never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4297 | 22 never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4298 | ) && !x->owner_privileges); never executed: return (( (*__errno_location ()) == 1 || (*__errno_location ()) == 22 ) && !x->owner_privileges); | 0 | ||||||||||||||||||||||||||||||
4299 | } | - | ||||||||||||||||||||||||||||||
4300 | - | |||||||||||||||||||||||||||||||
4301 | - | |||||||||||||||||||||||||||||||
4302 | - | |||||||||||||||||||||||||||||||
4303 | - | |||||||||||||||||||||||||||||||
4304 | - | |||||||||||||||||||||||||||||||
4305 | - | |||||||||||||||||||||||||||||||
4306 | - | |||||||||||||||||||||||||||||||
4307 | extern mode_t | - | ||||||||||||||||||||||||||||||
4308 | cached_umask (void) | - | ||||||||||||||||||||||||||||||
4309 | { | - | ||||||||||||||||||||||||||||||
4310 | static mode_t mask = (mode_t) -1; | - | ||||||||||||||||||||||||||||||
4311 | if (mask == (mode_t) -1
| 1-6 | ||||||||||||||||||||||||||||||
4312 | { | - | ||||||||||||||||||||||||||||||
4313 | mask = umask (0); | - | ||||||||||||||||||||||||||||||
4314 | umask (mask); | - | ||||||||||||||||||||||||||||||
4315 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
4316 | return executed 7 times by 1 test: mask;return mask; Executed by:
executed 7 times by 1 test: return mask; Executed by:
| 7 | ||||||||||||||||||||||||||||||
4317 | } | - | ||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |