Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | enum { DEFAULT_PASSES = 3 }; | - |
9 | | - |
10 | | - |
11 | | - |
12 | enum { VERBOSE_UPDATE = 5 }; | - |
13 | | - |
14 | | - |
15 | | - |
16 | enum { SECTOR_SIZE = 512 }; | - |
17 | enum { SECTOR_MASK = SECTOR_SIZE - 1 }; | - |
18 | _Static_assert (0 < SECTOR_SIZE && (SECTOR_SIZE & SECTOR_MASK) == 0, "verify (" "0 < SECTOR_SIZE && (SECTOR_SIZE & SECTOR_MASK) == 0" ")"); | - |
19 | | - |
20 | enum remove_method | - |
21 | { | - |
22 | remove_none = 0, | - |
23 | remove_unlink, | - |
24 | remove_wipe, | - |
25 | remove_wipesync | - |
26 | }; | - |
27 | | - |
28 | static char const *const remove_args[] = | - |
29 | { | - |
30 | "unlink", "wipe", "wipesync", | - |
31 | ((void *)0) | - |
32 | | - |
33 | }; | - |
34 | | - |
35 | static enum remove_method const remove_methods[] = | - |
36 | { | - |
37 | remove_unlink, remove_wipe, remove_wipesync | - |
38 | }; | - |
39 | | - |
40 | struct Options | - |
41 | { | - |
42 | | - |
43 | _Bool | - |
44 | force; | - |
45 | size_t n_iterations; | - |
46 | off_t size; | - |
47 | enum remove_method remove_file; | - |
48 | | - |
49 | _Bool | - |
50 | verbose; | - |
51 | | - |
52 | _Bool | - |
53 | exact; | - |
54 | | - |
55 | _Bool | - |
56 | zero_fill; | - |
57 | }; | - |
58 | | - |
59 | | - |
60 | | - |
61 | enum | - |
62 | { | - |
63 | RANDOM_SOURCE_OPTION = 0x7f + 1 | - |
64 | }; | - |
65 | | - |
66 | static struct option const long_opts[] = | - |
67 | { | - |
68 | {"exact", | - |
69 | 0 | - |
70 | , | - |
71 | ((void *)0) | - |
72 | , 'x'}, | - |
73 | {"force", | - |
74 | 0 | - |
75 | , | - |
76 | ((void *)0) | - |
77 | , 'f'}, | - |
78 | {"iterations", | - |
79 | 1 | - |
80 | , | - |
81 | ((void *)0) | - |
82 | , 'n'}, | - |
83 | {"size", | - |
84 | 1 | - |
85 | , | - |
86 | ((void *)0) | - |
87 | , 's'}, | - |
88 | {"random-source", | - |
89 | 1 | - |
90 | , | - |
91 | ((void *)0) | - |
92 | , RANDOM_SOURCE_OPTION}, | - |
93 | {"remove", | - |
94 | 2 | - |
95 | , | - |
96 | ((void *)0) | - |
97 | , 'u'}, | - |
98 | {"verbose", | - |
99 | 0 | - |
100 | , | - |
101 | ((void *)0) | - |
102 | , 'v'}, | - |
103 | {"zero", | - |
104 | 0 | - |
105 | , | - |
106 | ((void *)0) | - |
107 | , 'z'}, | - |
108 | {"help", | - |
109 | 0 | - |
110 | , | - |
111 | ((void *)0) | - |
112 | , GETOPT_HELP_CHAR}, | - |
113 | {"version", | - |
114 | 0 | - |
115 | , | - |
116 | ((void *)0) | - |
117 | , GETOPT_VERSION_CHAR}, | - |
118 | { | - |
119 | ((void *)0) | - |
120 | , 0, | - |
121 | ((void *)0) | - |
122 | , 0} | - |
123 | }; | - |
124 | | - |
125 | void | - |
126 | usage (int status) | - |
127 | { | - |
128 | if (status != TRUE | evaluated 4 times by 1 test | FALSE | evaluated 14 times by 1 test |
| 4-14 |
129 | 0TRUE | evaluated 4 times by 1 test | FALSE | evaluated 14 times by 1 test |
| 4-14 |
130 | ) | - |
131 | do { fprintf ( | - |
132 | stderr | - |
133 | , | - |
134 | dcgettext (((void *)0), | - |
135 | "Try '%s --help' for more information.\n" | - |
136 | , 5) | - |
137 | , program_name); }executed 4 times by 1 test: end of block while (0); | 4 |
138 | else | - |
139 | { | - |
140 | printf ( | - |
141 | dcgettext (((void *)0), | - |
142 | "Usage: %s [OPTION]... FILE...\n" | - |
143 | , 5) | - |
144 | , program_name); | - |
145 | fputs_unlocked ( | - |
146 | dcgettext (((void *)0), | - |
147 | "Overwrite the specified FILE(s) repeatedly, in order to make it harder\nfor even very expensive hardware probing to recover the data.\n" | - |
148 | , 5) | - |
149 | , | - |
150 | stdout | - |
151 | ) | - |
152 | | - |
153 | | - |
154 | ; | - |
155 | fputs_unlocked ( | - |
156 | dcgettext (((void *)0), | - |
157 | "\nIf FILE is -, shred standard output.\n" | - |
158 | , 5) | - |
159 | , | - |
160 | stdout | - |
161 | ) | - |
162 | | - |
163 | | - |
164 | ; | - |
165 | | - |
166 | emit_mandatory_arg_note (); | - |
167 | | - |
168 | printf ( | - |
169 | dcgettext (((void *)0), | - |
170 | " -f, --force change permissions to allow writing if necessary\n -n, --iterations=N overwrite N times instead of the default (%d)\n --random-source=FILE get random bytes from FILE\n -s, --size=N shred this many bytes (suffixes like K, M, G accepted)\n" | - |
171 | , 5) | - |
172 | | - |
173 | | - |
174 | | - |
175 | | - |
176 | | - |
177 | , DEFAULT_PASSES); | - |
178 | fputs_unlocked ( | - |
179 | dcgettext (((void *)0), | - |
180 | " -u deallocate and remove file after overwriting\n --remove[=HOW] like -u but give control on HOW to delete; See below\n -v, --verbose show progress\n -x, --exact do not round file sizes up to the next full block;\n this is the default for non-regular files\n -z, --zero add a final overwrite with zeros to hide shredding\n" | - |
181 | , 5) | - |
182 | , | - |
183 | stdout | - |
184 | ) | - |
185 | | - |
186 | | - |
187 | | - |
188 | | - |
189 | | - |
190 | | - |
191 | ; | - |
192 | fputs_unlocked ( | - |
193 | dcgettext (((void *)0), | - |
194 | " --help display this help and exit\n" | - |
195 | , 5) | - |
196 | , | - |
197 | stdout | - |
198 | ); | - |
199 | fputs_unlocked ( | - |
200 | dcgettext (((void *)0), | - |
201 | " --version output version information and exit\n" | - |
202 | , 5) | - |
203 | , | - |
204 | stdout | - |
205 | ); | - |
206 | fputs_unlocked ( | - |
207 | dcgettext (((void *)0), | - |
208 | "\nDelete FILE(s) if --remove (-u) is specified. The default is not to remove\nthe files because it is common to operate on device files like /dev/hda,\nand those files usually should not be removed.\nThe optional HOW parameter indicates how to remove a directory entry:\n'unlink' => use a standard unlink call.\n'wipe' => also first obfuscate bytes in the name.\n'wipesync' => also sync each obfuscated byte to disk.\nThe default mode is 'wipesync', but note it can be expensive.\n\n" | - |
209 | , 5) | - |
210 | , | - |
211 | stdout | - |
212 | ) | - |
213 | ; | - |
214 | fputs_unlocked ( | - |
215 | dcgettext (((void *)0), | - |
216 | "CAUTION: Note that shred relies on a very important assumption:\nthat the file system overwrites data in place. This is the traditional\nway to do things, but many modern file system designs do not satisfy this\nassumption. The following are examples of file systems on which shred is\nnot effective, or is not guaranteed to be effective in all file system modes:\n\n" | - |
217 | , 5) | - |
218 | , | - |
219 | stdout | - |
220 | ) | - |
221 | | - |
222 | | - |
223 | | - |
224 | | - |
225 | | - |
226 | | - |
227 | ; | - |
228 | fputs_unlocked ( | - |
229 | dcgettext (((void *)0), | - |
230 | "* log-structured or journaled file systems, such as those supplied with\nAIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)\n\n* file systems that write redundant data and carry on even if some writes\nfail, such as RAID-based file systems\n\n* file systems that make snapshots, such as Network Appliance's NFS server\n\n" | - |
231 | , 5) | - |
232 | , | - |
233 | stdout | - |
234 | ) | - |
235 | ; | - |
236 | fputs_unlocked ( | - |
237 | dcgettext (((void *)0), | - |
238 | "* file systems that cache in temporary locations, such as NFS\nversion 3 clients\n\n* compressed file systems\n\n" | - |
239 | , 5) | - |
240 | , | - |
241 | stdout | - |
242 | ) | - |
243 | | - |
244 | | - |
245 | | - |
246 | | - |
247 | | - |
248 | ; | - |
249 | fputs_unlocked ( | - |
250 | dcgettext (((void *)0), | - |
251 | "In the case of ext3 file systems, the above disclaimer applies\n(and shred is thus of limited effectiveness) only in data=journal mode,\nwhich journals file data in addition to just metadata. In both the\ndata=ordered (default) and data=writeback modes, shred works as usual.\nExt3 journaling modes can be changed by adding the data=something option\nto the mount options for a particular file system in the /etc/fstab file,\nas documented in the mount man page (man mount).\n\n" | - |
252 | , 5) | - |
253 | , | - |
254 | stdout | - |
255 | ) | - |
256 | ; | - |
257 | fputs_unlocked ( | - |
258 | dcgettext (((void *)0), | - |
259 | "In addition, file system backups and remote mirrors may contain copies\nof the file that cannot be removed, and that will allow a shredded file\nto be recovered later.\n" | - |
260 | , 5) | - |
261 | , | - |
262 | stdout | - |
263 | ) | - |
264 | | - |
265 | | - |
266 | | - |
267 | ; | - |
268 | emit_ancillary_info ("shred"); | - |
269 | }executed 14 times by 1 test: end of block | 14 |
270 | exit (status);executed 18 times by 1 test: exit (status); | 18 |
271 | } | - |
272 | | - |
273 | | - |
274 | | - |
275 | | - |
276 | static | - |
277 | _Bool | - |
278 | | - |
279 | periodic_pattern (int type) | - |
280 | { | - |
281 | if (type <= 0TRUE | evaluated 96 times by 1 test | FALSE | evaluated 41 times by 1 test |
) | 41-96 |
282 | returnexecuted 96 times by 1 test: return 0 ; executed 96 times by 1 test: return 0 ; | 96 |
283 | 0executed 96 times by 1 test: return 0 ; | 96 |
284 | ;executed 96 times by 1 test: return 0 ; | 96 |
285 | | - |
286 | unsigned char r[3]; | - |
287 | unsigned int bits = type & 0xfff; | - |
288 | | - |
289 | bits |= bits << 12; | - |
290 | r[0] = (bits >> 4) & 255; | - |
291 | r[1] = (bits >> 8) & 255; | - |
292 | r[2] = bits & 255; | - |
293 | | - |
294 | returnexecuted 41 times by 1 test: return (r[0] != r[1]) || (r[0] != r[2]); (r[0] != r[1]) || (r[0] != r[2]);executed 41 times by 1 test: return (r[0] != r[1]) || (r[0] != r[2]); | 41 |
295 | } | - |
296 | | - |
297 | | - |
298 | | - |
299 | | - |
300 | | - |
301 | | - |
302 | | - |
303 | static void | - |
304 | fillpattern (int type, unsigned char *r, size_t size) | - |
305 | { | - |
306 | size_t i; | - |
307 | unsigned int bits = type & 0xfff; | - |
308 | | - |
309 | bits |= bits << 12; | - |
310 | r[0] = (bits >> 4) & 255; | - |
311 | r[1] = (bits >> 8) & 255; | - |
312 | r[2] = bits & 255; | - |
313 | for (i = 3; i <= size / 2TRUE | evaluated 210 times by 1 test | FALSE | evaluated 58 times by 1 test |
; i *= 2) | 58-210 |
314 | memcpy (r + i, r, i);executed 210 times by 1 test: memcpy (r + i, r, i); | 210 |
315 | if (i < sizeTRUE | evaluated 27 times by 1 test | FALSE | evaluated 31 times by 1 test |
) | 27-31 |
316 | memcpy (r + i, r, size - i);executed 27 times by 1 test: memcpy (r + i, r, size - i); | 27 |
317 | | - |
318 | | - |
319 | if (type & 0x1000TRUE | never evaluated | FALSE | evaluated 58 times by 1 test |
) | 0-58 |
320 | for (i = 0; i < sizeTRUE | never evaluated | FALSE | never evaluated |
; i += SECTOR_SIZE) | 0 |
321 | r[i] ^= 0x80; never executed: r[i] ^= 0x80; | 0 |
322 | }executed 58 times by 1 test: end of block | 58 |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | static void | - |
330 | passname (unsigned char const *data, char name[7]) | - |
331 | { | - |
332 | if (dataTRUE | evaluated 58 times by 1 test | FALSE | evaluated 79 times by 1 test |
) | 58-79 |
333 | sprintf (name, "%02x%02x%02x", data[0], data[1], data[2]);executed 58 times by 1 test: sprintf (name, "%02x%02x%02x", data[0], data[1], data[2]); | 58 |
334 | else | - |
335 | memcpy (name, "random", 7);executed 79 times by 1 test: memcpy (name, "random", 7); | 79 |
336 | } | - |
337 | | - |
338 | | - |
339 | | - |
340 | static | - |
341 | _Bool | - |
342 | | - |
343 | ignorable_sync_errno (int errno_val) | - |
344 | { | - |
345 | return never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); (errno_val == never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
346 | 22 never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
347 | never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
348 | || errno_val == never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
349 | 9 never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
350 | | 0 |
351 | never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
352 | || errno_val == never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
353 | 21 never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
354 | ); never executed: return (errno_val == 22 || errno_val == 9 || errno_val == 21 ); | 0 |
355 | } | - |
356 | | - |
357 | | - |
358 | | - |
359 | | - |
360 | | - |
361 | | - |
362 | | - |
363 | static int | - |
364 | dosync (int fd, char const *qname) | - |
365 | { | - |
366 | int err; | - |
367 | | - |
368 | | - |
369 | if (fdatasync (fd) == 0TRUE | evaluated 182 times by 1 test | FALSE | never evaluated |
) | 0-182 |
370 | returnexecuted 182 times by 1 test: return 0; 0;executed 182 times by 1 test: return 0; | 182 |
371 | err = | - |
372 | (*__errno_location ()) | - |
373 | ; | - |
374 | if ( ! ignorable_sync_errno (err)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
375 | { | - |
376 | error (0, err, | - |
377 | dcgettext (((void *)0), | - |
378 | "%s: fdatasync failed" | - |
379 | , 5) | - |
380 | , qname); | - |
381 | | - |
382 | (*__errno_location ()) | - |
383 | = err; | - |
384 | return never executed: return -1; -1;never executed: return -1; | 0 |
385 | } | - |
386 | | - |
387 | | - |
388 | if (fsync (fd) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
389 | return never executed: return 0; 0;never executed: return 0; | 0 |
390 | err = | - |
391 | (*__errno_location ()) | - |
392 | ; | - |
393 | if ( ! ignorable_sync_errno (err)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
394 | { | - |
395 | error (0, err, | - |
396 | dcgettext (((void *)0), | - |
397 | "%s: fsync failed" | - |
398 | , 5) | - |
399 | , qname); | - |
400 | | - |
401 | (*__errno_location ()) | - |
402 | = err; | - |
403 | return never executed: return -1; -1;never executed: return -1; | 0 |
404 | } | - |
405 | | - |
406 | sync (); | - |
407 | return never executed: return 0; 0;never executed: return 0; | 0 |
408 | } | - |
409 | | - |
410 | | - |
411 | | - |
412 | static void | - |
413 | direct_mode (int fd, | - |
414 | _Bool | - |
415 | enable) | - |
416 | { | - |
417 | if ( | - |
418 | 040000 | - |
419 | ) | - |
420 | { | - |
421 | int fd_flags = | - |
422 | rpl_fcntl | - |
423 | (fd, | - |
424 | 3 | - |
425 | ); | - |
426 | if (0 < fd_flagsTRUE | evaluated 4 times by 1 test | FALSE | never evaluated |
) | 0-4 |
427 | { | - |
428 | int new_flags = (enableTRUE | evaluated 2 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2 |
429 | ? (fd_flags | | - |
430 | 040000 | - |
431 | ) | - |
432 | : (fd_flags & ~ | - |
433 | 040000 | - |
434 | )); | - |
435 | if (new_flags != fd_flagsTRUE | evaluated 4 times by 1 test | FALSE | never evaluated |
) | 0-4 |
436 | | - |
437 | rpl_fcntl executed 4 times by 1 test: rpl_fcntl (fd, 4 , new_flags); | 4 |
438 | (fd, executed 4 times by 1 test: rpl_fcntl (fd, 4 , new_flags); | 4 |
439 | 4executed 4 times by 1 test: rpl_fcntl (fd, 4 , new_flags); | 4 |
440 | , new_flags);executed 4 times by 1 test: rpl_fcntl (fd, 4 , new_flags); | 4 |
441 | }executed 4 times by 1 test: end of block | 4 |
442 | }executed 4 times by 1 test: end of block | 4 |
443 | | - |
444 | | - |
445 | | - |
446 | | - |
447 | | - |
448 | } | - |
449 | | - |
450 | | - |
451 | static | - |
452 | _Bool | - |
453 | | - |
454 | dorewind (int fd, struct stat const *st) | - |
455 | { | - |
456 | if ( | - |
457 | ((((TRUE | never evaluated | FALSE | evaluated 137 times by 1 test |
| 0-137 |
458 | st->st_modeTRUE | never evaluated | FALSE | evaluated 137 times by 1 test |
| 0-137 |
459 | )) & 0170000) == (0020000))TRUE | never evaluated | FALSE | evaluated 137 times by 1 test |
| 0-137 |
460 | ) | - |
461 | { | - |
462 | | - |
463 | | - |
464 | | - |
465 | | - |
466 | struct mtop op; | - |
467 | op.mt_op = | - |
468 | 6 | - |
469 | ; | - |
470 | op.mt_count = 1; | - |
471 | if (ioctl (fd, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
472 | (((1U) << (((0 +8)+8)+14)) | ((('m')) << (0 +8)) | (((1)) << 0) | ((((sizeof(struct mtop)))) << ((0 +8)+8)))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
473 | , &op) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
474 | return never executed: return 1 ; never executed: return 1 ; | 0 |
475 | 1 never executed: return 1 ; | 0 |
476 | ; never executed: return 1 ; | 0 |
477 | | - |
478 | } never executed: end of block | 0 |
479 | off_t offset = lseek (fd, 0, | - |
480 | 0 | - |
481 | ); | - |
482 | if (0 < offsetTRUE | never evaluated | FALSE | evaluated 137 times by 1 test |
) | 0-137 |
483 | | - |
484 | (* never executed: (*__errno_location ()) = 22 ; __errno_location ()) never executed: (*__errno_location ()) = 22 ; | 0 |
485 | = never executed: (*__errno_location ()) = 22 ; | 0 |
486 | 22 never executed: (*__errno_location ()) = 22 ; | 0 |
487 | ; never executed: (*__errno_location ()) = 22 ; | 0 |
488 | returnexecuted 137 times by 1 test: return offset == 0; offset == 0;executed 137 times by 1 test: return offset == 0; | 137 |
489 | } | - |
490 | | - |
491 | | - |
492 | | - |
493 | static | - |
494 | _Bool | - |
495 | | - |
496 | known (off_t size) | - |
497 | { | - |
498 | returnexecuted 366 times by 1 test: return 0 <= size; 0 <= size;executed 366 times by 1 test: return 0 <= size; | 366 |
499 | } | - |
500 | static int | - |
501 | dopass (int fd, struct stat const *st, char const *qname, off_t *sizep, | - |
502 | int type, struct randread_source *s, | - |
503 | unsigned long int k, unsigned long int n) | - |
504 | { | - |
505 | off_t size = *sizep; | - |
506 | off_t offset; | - |
507 | time_t thresh ; | - |
508 | time_t now = 0; | - |
509 | size_t lim; | - |
510 | size_t soff; | - |
511 | ssize_t ssize; | - |
512 | | - |
513 | | - |
514 | size_t page_size = getpagesize (); | - |
515 | | - |
516 | | - |
517 | _Static_assert ((60 * 1024) % 3 == 0, "verify (" "PERIODIC_OUTPUT_SIZE % 3 == 0" ")"); | - |
518 | size_t output_size = periodic_pattern (type)TRUE | evaluated 12 times by 1 test | FALSE | evaluated 125 times by 1 test |
| 12-125 |
519 | ? (60 * 1024) : (64 * 1024); | - |
520 | | - |
521 | | - |
522 | | - |
523 | void *fill_pattern_mem = xmalloc (((page_size - 1) + (((output_size + 2) / 3) * 3))); | - |
524 | unsigned char *pbuf = ptr_align (fill_pattern_mem, page_size); | - |
525 | | - |
526 | char pass_string[7]; | - |
527 | | - |
528 | _Bool | - |
529 | write_error = | - |
530 | 0 | - |
531 | ; | - |
532 | | - |
533 | _Bool | - |
534 | other_error = | - |
535 | 0 | - |
536 | ; | - |
537 | | - |
538 | | - |
539 | char previous_offset_buf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * ( | - |
540 | 16 | - |
541 | + 1) - | - |
542 | 16 | - |
543 | + 1 + 3) + 1]; | - |
544 | char const *previous_human_offset ; | - |
545 | | - |
546 | | - |
547 | | - |
548 | | - |
549 | | - |
550 | _Bool | - |
551 | try_without_directio = 0 < sizeTRUE | evaluated 137 times by 1 test | FALSE | never evaluated |
&& size < output_sizeTRUE | evaluated 135 times by 1 test | FALSE | evaluated 2 times by 1 test |
; | 0-137 |
552 | if (! try_without_directioTRUE | evaluated 2 times by 1 test | FALSE | evaluated 135 times by 1 test |
) | 2-135 |
553 | direct_mode (fd, executed 2 times by 1 test: direct_mode (fd, 1 ); | 2 |
554 | 1executed 2 times by 1 test: direct_mode (fd, 1 ); | 2 |
555 | );executed 2 times by 1 test: direct_mode (fd, 1 ); | 2 |
556 | | - |
557 | if (! dorewind (fd, st)TRUE | never evaluated | FALSE | evaluated 137 times by 1 test |
) | 0-137 |
558 | { | - |
559 | error (0, | - |
560 | (*__errno_location ()) | - |
561 | , | - |
562 | dcgettext (((void *)0), | - |
563 | "%s: cannot rewind" | - |
564 | , 5) | - |
565 | , qname); | - |
566 | other_error = | - |
567 | 1 | - |
568 | ; | - |
569 | goto never executed: goto free_pattern_mem; free_pattern_mem;never executed: goto free_pattern_mem; | 0 |
570 | } | - |
571 | | - |
572 | | - |
573 | if (type >= 0TRUE | evaluated 58 times by 1 test | FALSE | evaluated 79 times by 1 test |
) | 58-79 |
574 | { | - |
575 | lim = known (size)TRUE | evaluated 58 times by 1 test | FALSE | never evaluated |
&& size < (((output_size + 2) / 3) * 3)TRUE | evaluated 58 times by 1 test | FALSE | never evaluated |
? size : (((output_size + 2) / 3) * 3); | 0-58 |
576 | fillpattern (type, pbuf, lim); | - |
577 | passname (pbuf, pass_string); | - |
578 | }executed 58 times by 1 test: end of block | 58 |
579 | else | - |
580 | { | - |
581 | passname (0, pass_string); | - |
582 | }executed 79 times by 1 test: end of block | 79 |
583 | | - |
584 | | - |
585 | if (nTRUE | evaluated 23 times by 1 test | FALSE | evaluated 114 times by 1 test |
) | 23-114 |
586 | { | - |
587 | error (0, 0, | - |
588 | dcgettext (((void *)0), | - |
589 | "%s: pass %lu/%lu (%s)..." | - |
590 | , 5) | - |
591 | , qname, k, n, pass_string); | - |
592 | thresh = time ( | - |
593 | ((void *)0) | - |
594 | ) + VERBOSE_UPDATE; | - |
595 | previous_human_offset = ""; | - |
596 | }executed 23 times by 1 test: end of block | 23 |
597 | | - |
598 | offset = 0; | - |
599 | while ( | - |
600 | 1 | - |
601 | ) | - |
602 | { | - |
603 | | - |
604 | lim = output_size; | - |
605 | if (known (size)TRUE | evaluated 306 times by 1 test | FALSE | never evaluated |
&& size - offset < output_sizeTRUE | evaluated 274 times by 1 test | FALSE | evaluated 32 times by 1 test |
) | 0-306 |
606 | { | - |
607 | if (size < offsetTRUE | never evaluated | FALSE | evaluated 274 times by 1 test |
) | 0-274 |
608 | break; never executed: break; | 0 |
609 | lim = size - offset; | - |
610 | if (!limTRUE | evaluated 137 times by 1 test | FALSE | evaluated 137 times by 1 test |
) | 137 |
611 | break;executed 137 times by 1 test: break; | 137 |
612 | }executed 137 times by 1 test: end of block | 137 |
613 | if (type < 0TRUE | evaluated 111 times by 1 test | FALSE | evaluated 58 times by 1 test |
) | 58-111 |
614 | randread (s, pbuf, lim);executed 111 times by 1 test: randread (s, pbuf, lim); | 111 |
615 | | - |
616 | for (soff = 0; soff < limTRUE | evaluated 171 times by 1 test | FALSE | evaluated 169 times by 1 test |
; soff += ssize) | 169-171 |
617 | { | - |
618 | ssize = write (fd, pbuf + soff, lim - soff); | - |
619 | if (0 < ssizeTRUE | evaluated 169 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-169 |
620 | ((executed 169 times by 1 test: ((ssize <= lim - soff) ? (void) 0 : __builtin_unreachable ()); ssize <= lim - soff) ? (void) 0 : __builtin_unreachable ());executed 169 times by 1 test: ((ssize <= lim - soff) ? (void) 0 : __builtin_unreachable ()); | 169 |
621 | else | - |
622 | { | - |
623 | if (! known (size)TRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
&& (ssize == 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0-2 |
624 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
625 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
626 | 28TRUE | never evaluated | FALSE | never evaluated |
| 0 |
627 | )) | - |
628 | { | - |
629 | | - |
630 | if (soff <= ((off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))) - offsetTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
631 | * never executed: *sizep = size = offset + soff; sizep = size = offset + soff;never executed: *sizep = size = offset + soff; | 0 |
632 | break; never executed: break; | 0 |
633 | } | - |
634 | else | - |
635 | { | - |
636 | int errnum = | - |
637 | (*__errno_location ()) | - |
638 | ; | - |
639 | char buf[((((((sizeof (uintmax_t) * 8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)]; | - |
640 | | - |
641 | | - |
642 | | - |
643 | | - |
644 | | - |
645 | if (! try_without_directioTRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
&& | 0-2 |
646 | (*TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
__errno_location ()) TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
| 0-2 |
647 | == TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
| 0-2 |
648 | 22TRUE | evaluated 2 times by 1 test | FALSE | never evaluated |
| 0-2 |
649 | ) | - |
650 | { | - |
651 | direct_mode (fd, | - |
652 | 0 | - |
653 | ); | - |
654 | ssize = 0; | - |
655 | try_without_directio = | - |
656 | 1 | - |
657 | ; | - |
658 | continue;executed 2 times by 1 test: continue; | 2 |
659 | } | - |
660 | error (0, errnum, | - |
661 | dcgettext (((void *)0), | - |
662 | "%s: error writing at offset %s" | - |
663 | , 5) | - |
664 | , | - |
665 | qname, umaxtostr (offset + soff, buf)); | - |
666 | | - |
667 | | - |
668 | | - |
669 | | - |
670 | | - |
671 | | - |
672 | _Static_assert ((60 * 1024) % SECTOR_SIZE == 0, "verify (" "PERIODIC_OUTPUT_SIZE % SECTOR_SIZE == 0" ")"); | - |
673 | _Static_assert ((64 * 1024) % SECTOR_SIZE == 0, "verify (" "NONPERIODIC_OUTPUT_SIZE % SECTOR_SIZE == 0" ")"); | - |
674 | if (errnum == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
675 | 5TRUE | never evaluated | FALSE | never evaluated |
| 0 |
676 | && known (size)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
677 | && (TRUE | never evaluated | FALSE | never evaluated |
soff | SECTOR_MASK) < limTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
678 | { | - |
679 | size_t soff1 = (soff | SECTOR_MASK) + 1; | - |
680 | if (lseek (fd, offset + soff1, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
681 | 0TRUE | never evaluated | FALSE | never evaluated |
| 0 |
682 | ) != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
683 | { | - |
684 | | - |
685 | ssize = soff1 - soff; | - |
686 | write_error = | - |
687 | 1 | - |
688 | ; | - |
689 | continue; never executed: continue; | 0 |
690 | } | - |
691 | error (0, | - |
692 | (*__errno_location ()) | - |
693 | , | - |
694 | dcgettext (((void *)0), | - |
695 | "%s: lseek failed" | - |
696 | , 5) | - |
697 | , qname); | - |
698 | } never executed: end of block | 0 |
699 | other_error = | - |
700 | 1 | - |
701 | ; | - |
702 | goto never executed: goto free_pattern_mem; free_pattern_mem;never executed: goto free_pattern_mem; | 0 |
703 | } | - |
704 | } | - |
705 | } | - |
706 | | - |
707 | | - |
708 | | - |
709 | if (((TRUE | never evaluated | FALSE | evaluated 169 times by 1 test |
off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))) - offset < soffTRUE | never evaluated | FALSE | evaluated 169 times by 1 test |
) | 0-169 |
710 | { | - |
711 | error (0, 0, | - |
712 | dcgettext (((void *)0), | - |
713 | "%s: file too large" | - |
714 | , 5) | - |
715 | , qname); | - |
716 | other_error = | - |
717 | 1 | - |
718 | ; | - |
719 | goto never executed: goto free_pattern_mem; free_pattern_mem;never executed: goto free_pattern_mem; | 0 |
720 | } | - |
721 | | - |
722 | offset += soff; | - |
723 | | - |
724 | | - |
725 | _Bool | - |
726 | done = offset == size; | - |
727 | | - |
728 | | - |
729 | if (nTRUE | evaluated 23 times by 1 test | FALSE | evaluated 146 times by 1 test |
&& ((doneTRUE | evaluated 23 times by 1 test | FALSE | never evaluated |
&& *TRUE | never evaluated | FALSE | evaluated 23 times by 1 test |
previous_human_offsetTRUE | never evaluated | FALSE | evaluated 23 times by 1 test |
) | 0-146 |
730 | || thresh <= (now = time (TRUE | never evaluated | FALSE | evaluated 23 times by 1 test |
| 0-23 |
731 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 23 times by 1 test |
| 0-23 |
732 | ))TRUE | never evaluated | FALSE | evaluated 23 times by 1 test |
)) | 0-23 |
733 | { | - |
734 | char offset_buf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * ( | - |
735 | 16 | - |
736 | + 1) - | - |
737 | 16 | - |
738 | + 1 + 3) + 1]; | - |
739 | char size_buf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * ( | - |
740 | 16 | - |
741 | + 1) - | - |
742 | 16 | - |
743 | + 1 + 3) + 1]; | - |
744 | int human_progress_opts = (human_autoscale | human_SI | - |
745 | | human_base_1024 | human_B); | - |
746 | char const *human_offset | - |
747 | = human_readable (offset, offset_buf, | - |
748 | human_floor | human_progress_opts, 1, 1); | - |
749 | | - |
750 | if (doneTRUE | never evaluated | FALSE | never evaluated |
|| !(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
751 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
752 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
753 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
754 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
755 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
756 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
757 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
758 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
759 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
760 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
761 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
762 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
763 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
764 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
765 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
766 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
767 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
768 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
769 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
770 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
771 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
772 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
773 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
774 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
775 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
776 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
777 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
778 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
779 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
780 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
781 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
782 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
783 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
784 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
785 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
786 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
787 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
788 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
789 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
790 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
791 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
792 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
793 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
794 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
795 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
796 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
797 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( previous_human_offset ))[3] - __s2[3]); | 0 |
798 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( previous_human_offset ))[3] - __s2[3]); | 0 |
799 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
800 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
801 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
802 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
803 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
804 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
805 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
806 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
807 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
808 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
809 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
810 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
811 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
812 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
813 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
814 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
815 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
816 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
817 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
818 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
819 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
820 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
821 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
822 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
823 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
824 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
825 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( human_offset ))[3] - __s2[3]); | 0 |
826 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( human_offset ))[3] - __s2[3]); | 0 |
827 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
828 | previous_human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
829 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
830 | human_offsetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
831 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
832 | == 0)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
833 | { | - |
834 | if (! known (size)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
835 | error (0, 0, never executed: error (0, 0, dcgettext (((void *)0), "%s: pass %lu/%lu (%s)...%s" , 5) , qname, k, n, pass_string, human_offset); | 0 |
836 | dcgettext (((void *)0), never executed: error (0, 0, dcgettext (((void *)0), "%s: pass %lu/%lu (%s)...%s" , 5) , qname, k, n, pass_string, human_offset); | 0 |
837 | "%s: pass %lu/%lu (%s)...%s" never executed: error (0, 0, dcgettext (((void *)0), "%s: pass %lu/%lu (%s)...%s" , 5) , qname, k, n, pass_string, human_offset); | 0 |
838 | , 5) never executed: error (0, 0, dcgettext (((void *)0), "%s: pass %lu/%lu (%s)...%s" , 5) , qname, k, n, pass_string, human_offset); | 0 |
839 | , never executed: error (0, 0, dcgettext (((void *)0), "%s: pass %lu/%lu (%s)...%s" , 5) , qname, k, n, pass_string, human_offset); | 0 |
840 | qname, k, n, pass_string, human_offset); never executed: error (0, 0, dcgettext (((void *)0), "%s: pass %lu/%lu (%s)...%s" , 5) , qname, k, n, pass_string, human_offset); | 0 |
841 | else | - |
842 | { | - |
843 | uintmax_t off = offset; | - |
844 | int percent = (size == 0TRUE | never evaluated | FALSE | never evaluated |
| 0 |
845 | ? 100 | - |
846 | : (off <= ((uintmax_t) (! (! ((uintmax_t) 0 < (uintmax_t) -1)) ? (uintmax_t) -1 : ((((uintmax_t) 1 << ((sizeof (uintmax_t) * 8) - 2)) - 1) * 2 + 1))) / 100TRUE | never evaluated | FALSE | never evaluated |
| 0 |
847 | ? off * 100 / size | - |
848 | : off / (size / 100))); | - |
849 | char const *human_size | - |
850 | = human_readable (size, size_buf, | - |
851 | human_ceiling | human_progress_opts, | - |
852 | 1, 1); | - |
853 | if (doneTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
854 | human_offset = human_size; never executed: human_offset = human_size; | 0 |
855 | error (0, 0, | - |
856 | dcgettext (((void *)0), | - |
857 | "%s: pass %lu/%lu (%s)...%s/%s %d%%" | - |
858 | , 5) | - |
859 | , | - |
860 | qname, k, n, pass_string, human_offset, human_size, | - |
861 | percent); | - |
862 | } never executed: end of block | 0 |
863 | | - |
864 | strcpy (previous_offset_buf, human_offset); | - |
865 | previous_human_offset = previous_offset_buf; | - |
866 | thresh = now + VERBOSE_UPDATE; | - |
867 | if (dosync (fd, qname) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
868 | { | - |
869 | if ( | - |
870 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
871 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
872 | 5TRUE | never evaluated | FALSE | never evaluated |
| 0 |
873 | ) | - |
874 | { | - |
875 | other_error = | - |
876 | 1 | - |
877 | ; | - |
878 | goto never executed: goto free_pattern_mem; free_pattern_mem;never executed: goto free_pattern_mem; | 0 |
879 | } | - |
880 | write_error = | - |
881 | 1 | - |
882 | ; | - |
883 | } never executed: end of block | 0 |
884 | } never executed: end of block | 0 |
885 | } never executed: end of block | 0 |
886 | }executed 169 times by 1 test: end of block | 169 |
887 | | - |
888 | | - |
889 | if (dosync (fd, qname) != 0TRUE | never evaluated | FALSE | evaluated 137 times by 1 test |
) | 0-137 |
890 | { | - |
891 | if ( | - |
892 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
893 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
894 | 5TRUE | never evaluated | FALSE | never evaluated |
| 0 |
895 | ) | - |
896 | { | - |
897 | other_error = | - |
898 | 1 | - |
899 | ; | - |
900 | goto never executed: goto free_pattern_mem; free_pattern_mem;never executed: goto free_pattern_mem; | 0 |
901 | } | - |
902 | write_error = | - |
903 | 1 | - |
904 | ; | - |
905 | } never executed: end of block | 0 |
906 | | - |
907 | free_pattern_mem:code before this statement executed 137 times by 1 test: free_pattern_mem: | 137 |
908 | free (fill_pattern_mem); | - |
909 | | - |
910 | returnexecuted 137 times by 1 test: return other_error ? -1 : write_error; other_error ? -1 : write_error;executed 137 times by 1 test: return other_error ? -1 : write_error; | 137 |
911 | } | - |
912 | static int const | - |
913 | patterns[] = | - |
914 | { | - |
915 | -2, | - |
916 | 2, 0x000, 0xFFF, | - |
917 | 2, 0x555, 0xAAA, | - |
918 | -1, | - |
919 | 6, 0x249, 0x492, 0x6DB, 0x924, 0xB6D, 0xDB6, | - |
920 | 12, 0x111, 0x222, 0x333, 0x444, 0x666, 0x777, | - |
921 | 0x888, 0x999, 0xBBB, 0xCCC, 0xDDD, 0xEEE, | - |
922 | -1, | - |
923 | | - |
924 | 8, 0x1000, 0x1249, 0x1492, 0x16DB, 0x1924, 0x1B6D, 0x1DB6, 0x1FFF, | - |
925 | 14, 0x1111, 0x1222, 0x1333, 0x1444, 0x1555, 0x1666, 0x1777, | - |
926 | 0x1888, 0x1999, 0x1AAA, 0x1BBB, 0x1CCC, 0x1DDD, 0x1EEE, | - |
927 | -1, | - |
928 | 0 | - |
929 | }; | - |
930 | | - |
931 | | - |
932 | | - |
933 | | - |
934 | | - |
935 | | - |
936 | | - |
937 | static void | - |
938 | genpattern (int *dest, size_t num, struct randint_source *s) | - |
939 | { | - |
940 | size_t randpasses; | - |
941 | int const *p; | - |
942 | int *d; | - |
943 | size_t n; | - |
944 | size_t accum, top, swap; | - |
945 | int k; | - |
946 | | - |
947 | if (!numTRUE | evaluated 4 times by 1 test | FALSE | evaluated 21 times by 1 test |
) | 4-21 |
948 | return;executed 4 times by 1 test: return; | 4 |
949 | | - |
950 | | - |
951 | p = patterns; | - |
952 | randpasses = 0; | - |
953 | d = dest; | - |
954 | n = num; | - |
955 | | - |
956 | while ( | - |
957 | 1 | - |
958 | ) | - |
959 | { | - |
960 | k = *p++; | - |
961 | if (!kTRUE | never evaluated | FALSE | evaluated 49 times by 1 test |
) | 0-49 |
962 | { | - |
963 | p = patterns; | - |
964 | } never executed: end of block | 0 |
965 | else if (k < 0TRUE | evaluated 22 times by 1 test | FALSE | evaluated 27 times by 1 test |
) | 22-27 |
966 | { | - |
967 | k = -k; | - |
968 | if ((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 20 times by 1 test |
size_t) k >= nTRUE | evaluated 2 times by 1 test | FALSE | evaluated 20 times by 1 test |
) | 2-20 |
969 | { | - |
970 | randpasses += n; | - |
971 | break;executed 2 times by 1 test: break; | 2 |
972 | } | - |
973 | randpasses += k; | - |
974 | n -= k; | - |
975 | }executed 20 times by 1 test: end of block | 20 |
976 | else if ((TRUE | evaluated 8 times by 1 test | FALSE | evaluated 19 times by 1 test |
size_t) k <= nTRUE | evaluated 8 times by 1 test | FALSE | evaluated 19 times by 1 test |
) | 8-19 |
977 | { | - |
978 | memcpy (d, p, k * sizeof (int)); | - |
979 | p += k; | - |
980 | d += k; | - |
981 | n -= k; | - |
982 | }executed 8 times by 1 test: end of block | 8 |
983 | else if (n < 2TRUE | evaluated 18 times by 1 test | FALSE | evaluated 1 time by 1 test |
|| 3 * n < (size_t) kTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-18 |
984 | { | - |
985 | randpasses += n; | - |
986 | break;executed 18 times by 1 test: break; | 18 |
987 | } | - |
988 | else | - |
989 | { | - |
990 | do | - |
991 | { | - |
992 | if (n == (size_t) kTRUE | evaluated 1 time by 1 test | FALSE | evaluated 11 times by 1 test |
|| randint_choose (s, k) < nTRUE | evaluated 6 times by 1 test | FALSE | evaluated 5 times by 1 test |
) | 1-11 |
993 | { | - |
994 | *d++ = *p; | - |
995 | n--; | - |
996 | }executed 7 times by 1 test: end of block | 7 |
997 | p++; | - |
998 | k--; | - |
999 | }executed 12 times by 1 test: end of block | 12 |
1000 | while (nTRUE | evaluated 11 times by 1 test | FALSE | evaluated 1 time by 1 test |
); | 1-11 |
1001 | break;executed 1 time by 1 test: break; | 1 |
1002 | } | - |
1003 | } | - |
1004 | top = num - randpasses; | - |
1005 | randpasses--; | - |
1006 | accum = randpasses; | - |
1007 | for (n = 0; n < numTRUE | evaluated 83 times by 1 test | FALSE | evaluated 21 times by 1 test |
; n++) | 21-83 |
1008 | { | - |
1009 | if (accum <= randpassesTRUE | evaluated 56 times by 1 test | FALSE | evaluated 27 times by 1 test |
) | 27-56 |
1010 | { | - |
1011 | accum += num - 1; | - |
1012 | dest[top++] = dest[n]; | - |
1013 | dest[n] = -1; | - |
1014 | }executed 56 times by 1 test: end of block | 56 |
1015 | else | - |
1016 | { | - |
1017 | swap = n + randint_choose (s, top - n); | - |
1018 | k = dest[n]; | - |
1019 | dest[n] = dest[swap]; | - |
1020 | dest[swap] = k; | - |
1021 | }executed 27 times by 1 test: end of block | 27 |
1022 | accum -= randpasses; | - |
1023 | }executed 83 times by 1 test: end of block | 83 |
1024 | | - |
1025 | }executed 21 times by 1 test: end of block | 21 |
1026 | | - |
1027 | | - |
1028 | | - |
1029 | | - |
1030 | | - |
1031 | static | - |
1032 | _Bool | - |
1033 | | - |
1034 | do_wipefd (int fd, char const *qname, struct randint_source *s, | - |
1035 | struct Options const *flags) | - |
1036 | { | - |
1037 | size_t i; | - |
1038 | struct stat st; | - |
1039 | off_t size; | - |
1040 | off_t i_size = 0; | - |
1041 | unsigned long int n; | - |
1042 | int *passarray; | - |
1043 | | - |
1044 | _Bool | - |
1045 | ok = | - |
1046 | 1 | - |
1047 | ; | - |
1048 | struct randread_source *rs; | - |
1049 | | - |
1050 | n = 0; | - |
1051 | if (flags->verboseTRUE | evaluated 4 times by 1 test | FALSE | evaluated 21 times by 1 test |
) | 4-21 |
1052 | n = flags->n_iterations + flags->zero_fill;executed 4 times by 1 test: n = flags->n_iterations + flags->zero_fill; | 4 |
1053 | | - |
1054 | if (fstat (fd, &st)TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
) | 0-25 |
1055 | { | - |
1056 | error (0, | - |
1057 | (*__errno_location ()) | - |
1058 | , | - |
1059 | dcgettext (((void *)0), | - |
1060 | "%s: fstat failed" | - |
1061 | , 5) | - |
1062 | , qname); | - |
1063 | return never executed: return 0 ; never executed: return 0 ; | 0 |
1064 | 0 never executed: return 0 ; | 0 |
1065 | ; never executed: return 0 ; | 0 |
1066 | } | - |
1067 | | - |
1068 | | - |
1069 | | - |
1070 | | - |
1071 | if (( | - |
1072 | ((((TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1073 | st.st_modeTRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1074 | )) & 0170000) == (0020000))TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1075 | && isatty (fd)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1076 | || | - |
1077 | ((((TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1078 | st.st_modeTRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1079 | )) & 0170000) == (0010000))TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1080 | | - |
1081 | || | - |
1082 | ((((TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1083 | st.st_modeTRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1084 | )) & 0170000) == (0140000))TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
| 0-25 |
1085 | ) | - |
1086 | { | - |
1087 | error (0, 0, | - |
1088 | dcgettext (((void *)0), | - |
1089 | "%s: invalid file type" | - |
1090 | , 5) | - |
1091 | , qname); | - |
1092 | return never executed: return 0 ; never executed: return 0 ; | 0 |
1093 | 0 never executed: return 0 ; | 0 |
1094 | ; never executed: return 0 ; | 0 |
1095 | } | - |
1096 | else if ( | - |
1097 | ((((TRUE | evaluated 25 times by 1 test | FALSE | never evaluated |
| 0-25 |
1098 | st.st_modeTRUE | evaluated 25 times by 1 test | FALSE | never evaluated |
| 0-25 |
1099 | )) & 0170000) == (0100000))TRUE | evaluated 25 times by 1 test | FALSE | never evaluated |
| 0-25 |
1100 | && st.st_size < 0TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
) | 0-25 |
1101 | { | - |
1102 | error (0, 0, | - |
1103 | dcgettext (((void *)0), | - |
1104 | "%s: file has negative size" | - |
1105 | , 5) | - |
1106 | , qname); | - |
1107 | return never executed: return 0 ; never executed: return 0 ; | 0 |
1108 | 0 never executed: return 0 ; | 0 |
1109 | ; never executed: return 0 ; | 0 |
1110 | } | - |
1111 | | - |
1112 | | - |
1113 | passarray = xnmalloc (flags->n_iterations, sizeof *passarray); | - |
1114 | | - |
1115 | size = flags->size; | - |
1116 | if (size == -1TRUE | evaluated 17 times by 1 test | FALSE | evaluated 8 times by 1 test |
) | 8-17 |
1117 | { | - |
1118 | if ( | - |
1119 | ((((TRUE | evaluated 17 times by 1 test | FALSE | never evaluated |
| 0-17 |
1120 | st.st_modeTRUE | evaluated 17 times by 1 test | FALSE | never evaluated |
| 0-17 |
1121 | )) & 0170000) == (0100000))TRUE | evaluated 17 times by 1 test | FALSE | never evaluated |
| 0-17 |
1122 | ) | - |
1123 | { | - |
1124 | size = st.st_size; | - |
1125 | | - |
1126 | if (! flags->exactTRUE | evaluated 12 times by 1 test | FALSE | evaluated 5 times by 1 test |
) | 5-12 |
1127 | { | - |
1128 | | - |
1129 | off_t remainder = size % ((0 < (st).st_blksizeTRUE | evaluated 12 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 12 times by 1 test | FALSE | never evaluated |
st).st_blksize <= ((size_t)-1) / 8 + 1TRUE | evaluated 12 times by 1 test | FALSE | never evaluated |
) ? (st).st_blksize : | 0-12 |
1130 | 512 | - |
1131 | ); | - |
1132 | if (sizeTRUE | evaluated 5 times by 1 test | FALSE | evaluated 7 times by 1 test |
&& size < ((0 < (st).st_blksize && (st).st_blksize <= ((size_t)-1) / 8 + 1) ? (st).st_blksize : TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-7 |
1133 | 512TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1134 | )TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
) | 0-5 |
1135 | i_size = size;executed 5 times by 1 test: i_size = size; | 5 |
1136 | if (remainder != 0TRUE | evaluated 5 times by 1 test | FALSE | evaluated 7 times by 1 test |
) | 5-7 |
1137 | { | - |
1138 | off_t size_incr = ((0 < (st).st_blksizeTRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
&& (TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
st).st_blksize <= ((size_t)-1) / 8 + 1TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
) ? (st).st_blksize : | 0-5 |
1139 | 512 | - |
1140 | ) - remainder; | - |
1141 | size += | - |
1142 | (((TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1143 | size_incrTRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1144 | )<(TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1145 | ((off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))) - sizeTRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
| 0-5 |
1146 | ))TRUE | evaluated 5 times by 1 test | FALSE | never evaluated |
?( | 0-5 |
1147 | size_incr | - |
1148 | ):( | - |
1149 | ((off_t) (! (! ((off_t) 0 < (off_t) -1)) ? (off_t) -1 : ((((off_t) 1 << ((sizeof (off_t) * 8) - 2)) - 1) * 2 + 1))) - size | - |
1150 | )) | - |
1151 | ; | - |
1152 | }executed 5 times by 1 test: end of block | 5 |
1153 | }executed 12 times by 1 test: end of block | 12 |
1154 | }executed 17 times by 1 test: end of block | 17 |
1155 | else | - |
1156 | { | - |
1157 | | - |
1158 | | - |
1159 | | - |
1160 | size = lseek (fd, 0, | - |
1161 | 2 | - |
1162 | ); | - |
1163 | if (size <= 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1164 | { | - |
1165 | | - |
1166 | | - |
1167 | size = -1; | - |
1168 | } never executed: end of block | 0 |
1169 | } never executed: end of block | 0 |
1170 | } | - |
1171 | else if ( | - |
1172 | ((((TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1173 | st.st_modeTRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1174 | )) & 0170000) == (0100000))TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1175 | | - |
1176 | && st.st_size < TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1177 | (((TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1178 | ((0 < (st).st_blksize && (st).st_blksize <= ((size_t)-1) / 8 + 1) ? (st).st_blksize : TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1179 | 512TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1180 | )TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1181 | )<(TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1182 | sizeTRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1183 | ))?(TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1184 | ((0 < (st).st_blksize && (st).st_blksize <= ((size_t)-1) / 8 + 1) ? (st).st_blksize : TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1185 | 512TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1186 | )TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1187 | ):(TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1188 | sizeTRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1189 | ))TRUE | evaluated 8 times by 1 test | FALSE | never evaluated |
| 0-8 |
1190 | ) | - |
1191 | i_size = st.st_size;executed 8 times by 1 test: i_size = st.st_size; | 8 |
1192 | | - |
1193 | | - |
1194 | genpattern (passarray, flags->n_iterations, s); | - |
1195 | | - |
1196 | rs = randint_get_source (s); | - |
1197 | | - |
1198 | while ( | - |
1199 | 1 | - |
1200 | ) | - |
1201 | { | - |
1202 | off_t pass_size; | - |
1203 | unsigned long int pn = n; | - |
1204 | | - |
1205 | if (i_sizeTRUE | evaluated 12 times by 1 test | FALSE | evaluated 43 times by 1 test |
) | 12-43 |
1206 | { | - |
1207 | pass_size = i_size; | - |
1208 | i_size = 0; | - |
1209 | pn = 0; | - |
1210 | }executed 12 times by 1 test: end of block | 12 |
1211 | else if (sizeTRUE | evaluated 18 times by 1 test | FALSE | evaluated 25 times by 1 test |
) | 18-25 |
1212 | { | - |
1213 | pass_size = size; | - |
1214 | size = 0; | - |
1215 | }executed 18 times by 1 test: end of block | 18 |
1216 | | - |
1217 | | - |
1218 | | - |
1219 | else | - |
1220 | break;executed 25 times by 1 test: break; | 25 |
1221 | | - |
1222 | for (i = 0; i < flags->n_iterations + flags->zero_fillTRUE | evaluated 137 times by 1 test | FALSE | evaluated 30 times by 1 test |
; i++) | 30-137 |
1223 | { | - |
1224 | int err = 0; | - |
1225 | int type = i < flags->n_iterationsTRUE | evaluated 131 times by 1 test | FALSE | evaluated 6 times by 1 test |
? passarray[i] : 0; | 6-131 |
1226 | | - |
1227 | err = dopass (fd, &st, qname, &pass_size, type, rs, i + 1, pn); | - |
1228 | | - |
1229 | if (errTRUE | never evaluated | FALSE | evaluated 137 times by 1 test |
) | 0-137 |
1230 | { | - |
1231 | ok = | - |
1232 | 0 | - |
1233 | ; | - |
1234 | if (err < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1235 | goto never executed: goto wipefd_out; wipefd_out;never executed: goto wipefd_out; | 0 |
1236 | } never executed: end of block | 0 |
1237 | }executed 137 times by 1 test: end of block | 137 |
1238 | }executed 30 times by 1 test: end of block | 30 |
1239 | | - |
1240 | | - |
1241 | | - |
1242 | | - |
1243 | if (flags->remove_fileTRUE | evaluated 15 times by 1 test | FALSE | evaluated 10 times by 1 test |
&& ftruncate (fd, 0) != 0TRUE | never evaluated | FALSE | evaluated 15 times by 1 test |
| 0-15 |
1244 | && | - |
1245 | ((((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1246 | st.st_modeTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1247 | )) & 0170000) == (0100000))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1248 | ) | - |
1249 | { | - |
1250 | error (0, | - |
1251 | (*__errno_location ()) | - |
1252 | , | - |
1253 | dcgettext (((void *)0), | - |
1254 | "%s: error truncating" | - |
1255 | , 5) | - |
1256 | , qname); | - |
1257 | ok = | - |
1258 | 0 | - |
1259 | ; | - |
1260 | goto never executed: goto wipefd_out; wipefd_out;never executed: goto wipefd_out; | 0 |
1261 | } | - |
1262 | | - |
1263 | wipefd_out:code before this statement executed 25 times by 1 test: wipefd_out: | 25 |
1264 | free (passarray); | - |
1265 | returnexecuted 25 times by 1 test: return ok; ok;executed 25 times by 1 test: return ok; | 25 |
1266 | } | - |
1267 | | - |
1268 | | - |
1269 | static | - |
1270 | _Bool | - |
1271 | | - |
1272 | wipefd (int fd, char const *qname, struct randint_source *s, | - |
1273 | struct Options const *flags) | - |
1274 | { | - |
1275 | int fd_flags = | - |
1276 | rpl_fcntl | - |
1277 | (fd, | - |
1278 | 3 | - |
1279 | ); | - |
1280 | | - |
1281 | if (fd_flags < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1282 | { | - |
1283 | error (0, | - |
1284 | (*__errno_location ()) | - |
1285 | , | - |
1286 | dcgettext (((void *)0), | - |
1287 | "%s: fcntl failed" | - |
1288 | , 5) | - |
1289 | , qname); | - |
1290 | return never executed: return 0 ; never executed: return 0 ; | 0 |
1291 | 0 never executed: return 0 ; | 0 |
1292 | ; never executed: return 0 ; | 0 |
1293 | } | - |
1294 | if (fd_flags & TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1295 | 02000TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1296 | ) | - |
1297 | { | - |
1298 | error (0, 0, | - |
1299 | dcgettext (((void *)0), | - |
1300 | "%s: cannot shred append-only file descriptor" | - |
1301 | , 5) | - |
1302 | , qname); | - |
1303 | return never executed: return 0 ; never executed: return 0 ; | 0 |
1304 | 0 never executed: return 0 ; | 0 |
1305 | ; never executed: return 0 ; | 0 |
1306 | } | - |
1307 | return never executed: return do_wipefd (fd, qname, s, flags); do_wipefd (fd, qname, s, flags);never executed: return do_wipefd (fd, qname, s, flags); | 0 |
1308 | } | - |
1309 | | - |
1310 | | - |
1311 | | - |
1312 | | - |
1313 | static char const nameset[] = | - |
1314 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; | - |
1315 | | - |
1316 | | - |
1317 | | - |
1318 | | - |
1319 | | - |
1320 | | - |
1321 | static | - |
1322 | _Bool | - |
1323 | | - |
1324 | incname (char *name, size_t len) | - |
1325 | { | - |
1326 | while (len--TRUE | evaluated 65 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-65 |
1327 | { | - |
1328 | char const *p = | - |
1329 | (__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 65 times by 1 test |
| 0-65 |
1330 | name[len]TRUE | never evaluated | FALSE | evaluated 65 times by 1 test |
| 0-65 |
1331 | )TRUE | never evaluated | FALSE | evaluated 65 times by 1 test |
&& !__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0-65 |
1332 | namesetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1333 | )TRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1334 | name[len]TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1335 | ) == '\0'TRUE | never evaluated | FALSE | never evaluated |
? (char *) __rawmemchr ( | 0 |
1336 | nameset | - |
1337 | , | - |
1338 | name[len] | - |
1339 | ) : __builtin_strchr ( | - |
1340 | nameset | - |
1341 | , | - |
1342 | name[len] | - |
1343 | ))) | - |
1344 | ; | - |
1345 | | - |
1346 | | - |
1347 | | - |
1348 | | - |
1349 | (( | - |
1350 | p | - |
1351 | ) ? (void) (0) : __assert_fail ( | - |
1352 | "p" | - |
1353 | , "src/shred.c", 1034, __PRETTY_FUNCTION__)) | - |
1354 | ; | - |
1355 | | - |
1356 | | - |
1357 | if (p[1]TRUE | evaluated 64 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-64 |
1358 | { | - |
1359 | name[len] = p[1]; | - |
1360 | returnexecuted 64 times by 1 test: return 1 ; executed 64 times by 1 test: return 1 ; | 64 |
1361 | 1executed 64 times by 1 test: return 1 ; | 64 |
1362 | ;executed 64 times by 1 test: return 1 ; | 64 |
1363 | } | - |
1364 | | - |
1365 | | - |
1366 | name[len] = nameset[0]; | - |
1367 | }executed 1 time by 1 test: end of block | 1 |
1368 | | - |
1369 | returnexecuted 1 time by 1 test: return 0 ; executed 1 time by 1 test: return 0 ; | 1 |
1370 | 0executed 1 time by 1 test: return 0 ; | 1 |
1371 | ;executed 1 time by 1 test: return 0 ; | 1 |
1372 | } | - |
1373 | static | - |
1374 | _Bool | - |
1375 | | - |
1376 | wipename (char *oldname, char const *qoldname, struct Options const *flags) | - |
1377 | { | - |
1378 | char *newname = xstrdup (oldname); | - |
1379 | char *base = last_component (newname); | - |
1380 | char *dir = dir_name (newname); | - |
1381 | char *qdir = xstrdup (quotearg_n_style_colon (0, shell_escape_quoting_style, dir)); | - |
1382 | | - |
1383 | _Bool | - |
1384 | first = | - |
1385 | 1 | - |
1386 | ; | - |
1387 | | - |
1388 | _Bool | - |
1389 | ok = | - |
1390 | 1 | - |
1391 | ; | - |
1392 | int dir_fd = -1; | - |
1393 | | - |
1394 | if (flags->remove_file == remove_wipesyncTRUE | evaluated 13 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-13 |
1395 | dir_fd = open_safer (dir, executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1396 | 00 executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1397 | | executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1398 | 0200000 executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1399 | | executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1400 | 0400 executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1401 | | executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1402 | 04000executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1403 | );executed 13 times by 1 test: dir_fd = open_safer (dir, 00 | 0200000 | 0400 | 04000 ); | 13 |
1404 | | - |
1405 | if (flags->verboseTRUE | evaluated 4 times by 1 test | FALSE | evaluated 11 times by 1 test |
) | 4-11 |
1406 | error (0, 0, executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removing" , 5) , qoldname); | 4 |
1407 | dcgettext (((void *)0), executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removing" , 5) , qoldname); | 4 |
1408 | "%s: removing"executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removing" , 5) , qoldname); | 4 |
1409 | , 5)executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removing" , 5) , qoldname); | 4 |
1410 | , qoldname);executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removing" , 5) , qoldname); | 4 |
1411 | | - |
1412 | if (flags->remove_file != remove_unlinkTRUE | evaluated 14 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-14 |
1413 | for (size_t len = base_len (base); len != 0TRUE | evaluated 53 times by 1 test | FALSE | evaluated 14 times by 1 test |
; len--) | 14-53 |
1414 | { | - |
1415 | memset (base, nameset[0], len); | - |
1416 | base[len] = 0; | - |
1417 | | - |
1418 | _Bool | - |
1419 | rename_ok; | - |
1420 | while (! (rename_ok = (renameat2 (TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1421 | -100TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1422 | , oldname, TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1423 | -100TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1424 | , newname,TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1425 | TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1426 | (1 << 0)TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1427 | )TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1428 | == 0))TRUE | evaluated 75 times by 1 test | FALSE | evaluated 42 times by 1 test |
| 42-75 |
1429 | && | - |
1430 | (*TRUE | evaluated 65 times by 1 test | FALSE | evaluated 10 times by 1 test |
__errno_location ()) TRUE | evaluated 65 times by 1 test | FALSE | evaluated 10 times by 1 test |
| 10-65 |
1431 | == TRUE | evaluated 65 times by 1 test | FALSE | evaluated 10 times by 1 test |
| 10-65 |
1432 | 17TRUE | evaluated 65 times by 1 test | FALSE | evaluated 10 times by 1 test |
| 10-65 |
1433 | && incname (base, len)TRUE | evaluated 64 times by 1 test | FALSE | evaluated 1 time by 1 test |
) | 1-64 |
1434 | continue;executed 64 times by 1 test: continue; | 64 |
1435 | if (rename_okTRUE | evaluated 42 times by 1 test | FALSE | evaluated 11 times by 1 test |
) | 11-42 |
1436 | { | - |
1437 | if (0 <= dir_fdTRUE | evaluated 32 times by 1 test | FALSE | evaluated 10 times by 1 test |
&& dosync (dir_fd, qdir) != 0TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
) | 0-32 |
1438 | ok = never executed: ok = 0 ; | 0 |
1439 | 0 never executed: ok = 0 ; | 0 |
1440 | ; never executed: ok = 0 ; | 0 |
1441 | if (flags->verboseTRUE | evaluated 6 times by 1 test | FALSE | evaluated 36 times by 1 test |
) | 6-36 |
1442 | { | - |
1443 | | - |
1444 | | - |
1445 | | - |
1446 | | - |
1447 | char const *old = firstTRUE | evaluated 4 times by 1 test | FALSE | evaluated 2 times by 1 test |
? qoldname : oldname; | 2-4 |
1448 | error (0, 0, | - |
1449 | | - |
1450 | dcgettext (((void *)0), | - |
1451 | "%s: renamed to %s" | - |
1452 | , 5) | - |
1453 | , old, newname); | - |
1454 | first = | - |
1455 | 0 | - |
1456 | ; | - |
1457 | }executed 6 times by 1 test: end of block | 6 |
1458 | memcpy (oldname + (base - newname), base, len + 1); | - |
1459 | }executed 42 times by 1 test: end of block | 42 |
1460 | }executed 53 times by 1 test: end of block | 53 |
1461 | | - |
1462 | if (unlink (oldname) != 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 14 times by 1 test |
) | 1-14 |
1463 | { | - |
1464 | error (0, | - |
1465 | (*__errno_location ()) | - |
1466 | , | - |
1467 | dcgettext (((void *)0), | - |
1468 | "%s: failed to remove" | - |
1469 | , 5) | - |
1470 | , qoldname); | - |
1471 | ok = | - |
1472 | 0 | - |
1473 | ; | - |
1474 | }executed 1 time by 1 test: end of block | 1 |
1475 | else if (flags->verboseTRUE | evaluated 4 times by 1 test | FALSE | evaluated 10 times by 1 test |
) | 4-10 |
1476 | error (0, 0, executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removed" , 5) , qoldname); | 4 |
1477 | dcgettext (((void *)0), executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removed" , 5) , qoldname); | 4 |
1478 | "%s: removed"executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removed" , 5) , qoldname); | 4 |
1479 | , 5)executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removed" , 5) , qoldname); | 4 |
1480 | , qoldname);executed 4 times by 1 test: error (0, 0, dcgettext (((void *)0), "%s: removed" , 5) , qoldname); | 4 |
1481 | if (0 <= dir_fdTRUE | evaluated 13 times by 1 test | FALSE | evaluated 2 times by 1 test |
) | 2-13 |
1482 | { | - |
1483 | if (dosync (dir_fd, qdir) != 0TRUE | never evaluated | FALSE | evaluated 13 times by 1 test |
) | 0-13 |
1484 | ok = never executed: ok = 0 ; | 0 |
1485 | 0 never executed: ok = 0 ; | 0 |
1486 | ; never executed: ok = 0 ; | 0 |
1487 | if (close (dir_fd) != 0TRUE | never evaluated | FALSE | evaluated 13 times by 1 test |
) | 0-13 |
1488 | { | - |
1489 | error (0, | - |
1490 | (*__errno_location ()) | - |
1491 | , | - |
1492 | dcgettext (((void *)0), | - |
1493 | "%s: failed to close" | - |
1494 | , 5) | - |
1495 | , qdir); | - |
1496 | ok = | - |
1497 | 0 | - |
1498 | ; | - |
1499 | } never executed: end of block | 0 |
1500 | }executed 13 times by 1 test: end of block | 13 |
1501 | free (newname); | - |
1502 | free (dir); | - |
1503 | free (qdir); | - |
1504 | returnexecuted 15 times by 1 test: return ok; ok;executed 15 times by 1 test: return ok; | 15 |
1505 | } | - |
1506 | static | - |
1507 | _Bool | - |
1508 | | - |
1509 | wipefile (char *name, char const *qname, | - |
1510 | struct randint_source *s, struct Options const *flags) | - |
1511 | { | - |
1512 | | - |
1513 | _Bool | - |
1514 | ok; | - |
1515 | int fd; | - |
1516 | | - |
1517 | fd = open_safer (name, | - |
1518 | 01 | - |
1519 | | | - |
1520 | 0400 | - |
1521 | | | - |
1522 | 0 | - |
1523 | ); | - |
1524 | if (fd < 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 25 times by 1 test |
| 1-25 |
1525 | && ( | - |
1526 | (*TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
__errno_location ()) TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
1527 | == TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
1528 | 13TRUE | evaluated 1 time by 1 test | FALSE | never evaluated |
| 0-1 |
1529 | && flags->forceTRUE | never evaluated | FALSE | evaluated 1 time by 1 test |
) | 0-1 |
1530 | && chmod (name, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1531 | 0200TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1532 | ) == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1533 | fd = open_safer (name, never executed: fd = open_safer (name, 01 | 0400 | 0 ); | 0 |
1534 | 01 never executed: fd = open_safer (name, 01 | 0400 | 0 ); | 0 |
1535 | | never executed: fd = open_safer (name, 01 | 0400 | 0 ); | 0 |
1536 | 0400 never executed: fd = open_safer (name, 01 | 0400 | 0 ); | 0 |
1537 | | never executed: fd = open_safer (name, 01 | 0400 | 0 ); | 0 |
1538 | 0 never executed: fd = open_safer (name, 01 | 0400 | 0 ); | 0 |
1539 | ); never executed: fd = open_safer (name, 01 | 0400 | 0 ); | 0 |
1540 | if (fd < 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 25 times by 1 test |
) | 1-25 |
1541 | { | - |
1542 | error (0, | - |
1543 | (*__errno_location ()) | - |
1544 | , | - |
1545 | dcgettext (((void *)0), | - |
1546 | "%s: failed to open for writing" | - |
1547 | , 5) | - |
1548 | , qname); | - |
1549 | returnexecuted 1 time by 1 test: return 0 ; executed 1 time by 1 test: return 0 ; | 1 |
1550 | 0executed 1 time by 1 test: return 0 ; | 1 |
1551 | ;executed 1 time by 1 test: return 0 ; | 1 |
1552 | } | - |
1553 | | - |
1554 | ok = do_wipefd (fd, qname, s, flags); | - |
1555 | if (close (fd) != 0TRUE | never evaluated | FALSE | evaluated 25 times by 1 test |
) | 0-25 |
1556 | { | - |
1557 | error (0, | - |
1558 | (*__errno_location ()) | - |
1559 | , | - |
1560 | dcgettext (((void *)0), | - |
1561 | "%s: failed to close" | - |
1562 | , 5) | - |
1563 | , qname); | - |
1564 | ok = | - |
1565 | 0 | - |
1566 | ; | - |
1567 | } never executed: end of block | 0 |
1568 | if (okTRUE | evaluated 25 times by 1 test | FALSE | never evaluated |
&& flags->remove_fileTRUE | evaluated 15 times by 1 test | FALSE | evaluated 10 times by 1 test |
) | 0-25 |
1569 | ok = wipename (name, qname, flags);executed 15 times by 1 test: ok = wipename (name, qname, flags); | 15 |
1570 | returnexecuted 25 times by 1 test: return ok; ok;executed 25 times by 1 test: return ok; | 25 |
1571 | } | - |
1572 | | - |
1573 | | - |
1574 | | - |
1575 | static struct randint_source *randint_source; | - |
1576 | | - |
1577 | | - |
1578 | | - |
1579 | | - |
1580 | static void | - |
1581 | clear_random_data (void) | - |
1582 | { | - |
1583 | randint_all_free (randint_source); | - |
1584 | }executed 24 times by 1 test: end of block | 24 |
1585 | | - |
1586 | | - |
1587 | int | - |
1588 | main (int argc, char **argv) | - |
1589 | { | - |
1590 | | - |
1591 | _Bool | - |
1592 | ok = | - |
1593 | 1 | - |
1594 | ; | - |
1595 | struct Options flags = { 0, }; | - |
1596 | char **file; | - |
1597 | int n_files; | - |
1598 | int c; | - |
1599 | int i; | - |
1600 | char const *random_source = | - |
1601 | ((void *)0) | - |
1602 | ; | - |
1603 | | - |
1604 | ; | - |
1605 | set_program_name (argv[0]); | - |
1606 | setlocale ( | - |
1607 | 6 | - |
1608 | , ""); | - |
1609 | bindtextdomain ("coreutils", "/usr/local/share/locale"); | - |
1610 | textdomain ("coreutils"); | - |
1611 | | - |
1612 | atexit (close_stdout); | - |
1613 | | - |
1614 | flags.n_iterations = DEFAULT_PASSES; | - |
1615 | flags.size = -1; | - |
1616 | | - |
1617 | while ((TRUE | evaluated 87 times by 1 test | FALSE | evaluated 24 times by 1 test |
c = getopt_long (argc, argv, "fn:s:uvxz", long_opts, TRUE | evaluated 87 times by 1 test | FALSE | evaluated 24 times by 1 test |
| 24-87 |
1618 | ((void *)0)TRUE | evaluated 87 times by 1 test | FALSE | evaluated 24 times by 1 test |
| 24-87 |
1619 | )) != -1TRUE | evaluated 87 times by 1 test | FALSE | evaluated 24 times by 1 test |
) | 24-87 |
1620 | { | - |
1621 | switch (c) | - |
1622 | { | - |
1623 | caseexecuted 2 times by 1 test: case 'f': 'f':executed 2 times by 1 test: case 'f': | 2 |
1624 | flags.force = | - |
1625 | 1 | - |
1626 | ; | - |
1627 | break;executed 2 times by 1 test: break; | 2 |
1628 | | - |
1629 | caseexecuted 15 times by 1 test: case 'n': 'n':executed 15 times by 1 test: case 'n': | 15 |
1630 | flags.n_iterations = xdectoumax (optarg, 0, | - |
1631 | | - |
1632 | ((((0x7fffffffffffffffL * 2UL + 1UL))<((18446744073709551615UL) | - |
1633 | / sizeof (int) | - |
1634 | ))?((0x7fffffffffffffffL * 2UL + 1UL)):((18446744073709551615UL) | - |
1635 | / sizeof (int) | - |
1636 | )) | - |
1637 | | - |
1638 | , "", | - |
1639 | | - |
1640 | dcgettext (((void *)0), | - |
1641 | "invalid number of passes" | - |
1642 | , 5) | - |
1643 | , 0); | - |
1644 | break;executed 13 times by 1 test: break; | 13 |
1645 | | - |
1646 | caseexecuted 2 times by 1 test: case RANDOM_SOURCE_OPTION: RANDOM_SOURCE_OPTION:executed 2 times by 1 test: case RANDOM_SOURCE_OPTION: | 2 |
1647 | if (random_sourceTRUE | never evaluated | FALSE | evaluated 2 times by 1 test |
&& !(TRUE | never evaluated | FALSE | never evaluated |
| 0-2 |
1648 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1649 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1650 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1651 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1652 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1653 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1654 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1655 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1656 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1657 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1658 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1659 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1660 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1661 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1662 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1663 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1664 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1665 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1666 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1667 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1668 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1669 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1670 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1671 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1672 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1673 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1674 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1675 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1676 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1677 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1678 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1679 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1680 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1681 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1682 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1683 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1684 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1685 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1686 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1687 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1688 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1689 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1690 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1691 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1692 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1693 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1694 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( random_source ))[3] - __s2[3]); | 0 |
1695 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( random_source ))[3] - __s2[3]); | 0 |
1696 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1697 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1698 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1699 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1700 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1701 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1702 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1703 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1704 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1705 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1706 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1707 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1708 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1709 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1710 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1711 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1712 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1713 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1714 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1715 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1716 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1717 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1718 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1719 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1720 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1721 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1722 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( optarg ))[3] - __s2[3]); | 0 |
1723 | optargTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( optarg ))[3] - __s2[3]); | 0 |
1724 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1725 | random_sourceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1726 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1727 | optargTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1728 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1729 | == 0)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1730 | (( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); !!sizeof (struct { _Static_assert (never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1731 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1732 | , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1733 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1734 | , 0, never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1735 | dcgettext (((void *)0), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1736 | "multiple random sources specified" never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1737 | , 5) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1738 | ), (( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1739 | 0 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1740 | ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1741 | 1 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1742 | , 0, never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1743 | dcgettext (((void *)0), never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1744 | "multiple random sources specified" never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1745 | , 5) never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1746 | ), (( never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1747 | 0 never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1748 | ) ? (void) 0 : __builtin_unreachable ())))); never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, 0, dcgettext (((void *)0), \"multiple random sources specified\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , 0, dcgettext (((void *)0), "multiple random sources specified" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))); | 0 |
1749 | random_source = optarg; | - |
1750 | break;executed 2 times by 1 test: break; | 2 |
1751 | | - |
1752 | caseexecuted 17 times by 1 test: case 'u': 'u':executed 17 times by 1 test: case 'u': | 17 |
1753 | if (optarg == |