| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/freopen.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | static FILE * | - | ||||||||||||
| 8 | orig_freopen (const char *filename, const char *mode, FILE *stream) | - | ||||||||||||
| 9 | { | - | ||||||||||||
| 10 | return executed 182 times by 5 tests: freopen (filename, mode, stream);return freopen (filename, mode, stream);Executed by:
executed 182 times by 5 tests: return freopen (filename, mode, stream);Executed by:
| 182 | ||||||||||||
| 11 | } | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | - | |||||||||||||
| 15 | - | |||||||||||||
| 16 | - | |||||||||||||
| 17 | - | |||||||||||||
| 18 | - | |||||||||||||
| 19 | FILE * | - | ||||||||||||
| 20 | rpl_freopen (const char *filename, const char *mode, FILE *stream) | - | ||||||||||||
| 21 | { | - | ||||||||||||
| 22 | FILE *result; | - | ||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | char const *null_device = "/dev/null"; | - | ||||||||||||
| 29 | - | |||||||||||||
| 30 | - | |||||||||||||
| 31 | - | |||||||||||||
| 32 | - | |||||||||||||
| 33 | - | |||||||||||||
| 34 | - | |||||||||||||
| 35 | result = orig_freopen (filename, mode, stream); | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | if (!result
| 2-179 | ||||||||||||
| 38 | { | - | ||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 | - | |||||||||||||
| 42 | - | |||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | } executed 2 times by 2 tests: end of blockExecuted by:
| 2 | ||||||||||||
| 46 | else if (filename
| 0-179 | ||||||||||||
| 47 | { | - | ||||||||||||
| 48 | int fd = fileno (result); | - | ||||||||||||
| 49 | if (dup2 (fd, fd) < 0
| 1-178 | ||||||||||||
| 50 | (*
| 0-1 | ||||||||||||
| 51 | ==
| 0-1 | ||||||||||||
| 52 | 9
| 0-1 | ||||||||||||
| 53 | ) | - | ||||||||||||
| 54 | { | - | ||||||||||||
| 55 | int nullfd = open (null_device, | - | ||||||||||||
| 56 | 00 | - | ||||||||||||
| 57 | | | - | ||||||||||||
| 58 | 02000000 | - | ||||||||||||
| 59 | ); | - | ||||||||||||
| 60 | int err = 0; | - | ||||||||||||
| 61 | if (nullfd != fd
| 0-1 | ||||||||||||
| 62 | { | - | ||||||||||||
| 63 | if (dup2 (nullfd, fd) < 0
| 0 | ||||||||||||
| 64 | err = 1; never executed: err = 1; | 0 | ||||||||||||
| 65 | close (nullfd); | - | ||||||||||||
| 66 | } never executed: end of block | 0 | ||||||||||||
| 67 | if (!err
| 0-1 | ||||||||||||
| 68 | result = orig_freopen (filename, mode, result); executed 1 time by 1 test: result = orig_freopen (filename, mode, result);Executed by:
| 1 | ||||||||||||
| 69 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 70 | } executed 179 times by 5 tests: end of blockExecuted by:
| 179 | ||||||||||||
| 71 | - | |||||||||||||
| 72 | return executed 181 times by 5 tests: result;return result;Executed by:
executed 181 times by 5 tests: return result;Executed by:
| 181 | ||||||||||||
| 73 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |