| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/opendir-safer.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | DIR * | - | ||||||||||||
| 8 | opendir_safer (char const *name) | - | ||||||||||||
| 9 | { | - | ||||||||||||
| 10 | DIR *dp = opendir (name); | - | ||||||||||||
| 11 | - | |||||||||||||
| 12 | if (dp
| 0-34049 | ||||||||||||
| 13 | { | - | ||||||||||||
| 14 | int fd = dirfd (dp); | - | ||||||||||||
| 15 | - | |||||||||||||
| 16 | if (0 <= fd
| 0-34049 | ||||||||||||
| 17 | 2
| 0-34049 | ||||||||||||
| 18 | ) | - | ||||||||||||
| 19 | { | - | ||||||||||||
| 20 | DIR *newdp; | - | ||||||||||||
| 21 | int e; | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 | int f = | - | ||||||||||||
| 24 | rpl_fcntl | - | ||||||||||||
| 25 | (fd, | - | ||||||||||||
| 26 | 1030 | - | ||||||||||||
| 27 | , | - | ||||||||||||
| 28 | 2 | - | ||||||||||||
| 29 | + 1); | - | ||||||||||||
| 30 | if (f < 0
| 0 | ||||||||||||
| 31 | { | - | ||||||||||||
| 32 | e = | - | ||||||||||||
| 33 | (*__errno_location ()) | - | ||||||||||||
| 34 | ; | - | ||||||||||||
| 35 | newdp = | - | ||||||||||||
| 36 | ((void *)0) | - | ||||||||||||
| 37 | ; | - | ||||||||||||
| 38 | } never executed: end of block | 0 | ||||||||||||
| 39 | else | - | ||||||||||||
| 40 | { | - | ||||||||||||
| 41 | newdp = fdopendir (f); | - | ||||||||||||
| 42 | e = | - | ||||||||||||
| 43 | (*__errno_location ()) | - | ||||||||||||
| 44 | ; | - | ||||||||||||
| 45 | if (! newdp
| 0 | ||||||||||||
| 46 | close (f); never executed: close (f); | 0 | ||||||||||||
| 47 | } never executed: end of block | 0 | ||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | - | |||||||||||||
| 51 | - | |||||||||||||
| 52 | closedir (dp); | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | (*__errno_location ()) | - | ||||||||||||
| 55 | = e; | - | ||||||||||||
| 56 | dp = newdp; | - | ||||||||||||
| 57 | } never executed: end of block | 0 | ||||||||||||
| 58 | } executed 34049 times by 2 tests: end of blockExecuted by:
| 34049 | ||||||||||||
| 59 | - | |||||||||||||
| 60 | return executed 34049 times by 2 tests: dp;return dp;Executed by:
executed 34049 times by 2 tests: return dp;Executed by:
| 34049 | ||||||||||||
| 61 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |