| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/fopen-safer.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | FILE * | - | ||||||||||||
| 7 | fopen_safer (char const *file, char const *mode) | - | ||||||||||||
| 8 | { | - | ||||||||||||
| 9 | FILE *fp = fopen (file, mode); | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | if (fp
| 8-3586 | ||||||||||||
| 12 | { | - | ||||||||||||
| 13 | int fd = fileno (fp); | - | ||||||||||||
| 14 | - | |||||||||||||
| 15 | if (0 <= fd
| 0-3586 | ||||||||||||
| 16 | 2
| 0-3586 | ||||||||||||
| 17 | ) | - | ||||||||||||
| 18 | { | - | ||||||||||||
| 19 | int f = dup_safer (fd); | - | ||||||||||||
| 20 | - | |||||||||||||
| 21 | if (f < 0
| 0 | ||||||||||||
| 22 | { | - | ||||||||||||
| 23 | int e = | - | ||||||||||||
| 24 | (*__errno_location ()) | - | ||||||||||||
| 25 | ; | - | ||||||||||||
| 26 | - | |||||||||||||
| 27 | rpl_fclose | - | ||||||||||||
| 28 | (fp); | - | ||||||||||||
| 29 | - | |||||||||||||
| 30 | (*__errno_location ()) | - | ||||||||||||
| 31 | = e; | - | ||||||||||||
| 32 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 33 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 34 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 35 | } | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | if ( | - | ||||||||||||
| 38 | rpl_fclose
| 0 | ||||||||||||
| 39 | (fp) != 0
| 0 | ||||||||||||
| 40 | || ! (fp = fdopen (f, mode))
| 0 | ||||||||||||
| 41 | { | - | ||||||||||||
| 42 | int e = | - | ||||||||||||
| 43 | (*__errno_location ()) | - | ||||||||||||
| 44 | ; | - | ||||||||||||
| 45 | close (f); | - | ||||||||||||
| 46 | - | |||||||||||||
| 47 | (*__errno_location ()) | - | ||||||||||||
| 48 | = e; | - | ||||||||||||
| 49 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 50 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 51 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 52 | } | - | ||||||||||||
| 53 | } never executed: end of block | 0 | ||||||||||||
| 54 | } executed 3586 times by 14 tests: end of blockExecuted by:
| 3586 | ||||||||||||
| 55 | - | |||||||||||||
| 56 | return executed 3594 times by 14 tests: fp;return fp;Executed by:
executed 3594 times by 14 tests: return fp;Executed by:
| 3594 | ||||||||||||
| 57 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |