| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/savewd.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | static | - | ||||||||||||||||||
| 8 | _Bool | - | ||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | savewd_save (struct savewd *wd) | - | ||||||||||||||||||
| 11 | { | - | ||||||||||||||||||
| 12 | switch (wd->state) | - | ||||||||||||||||||
| 13 | { | - | ||||||||||||||||||
| 14 | case executed 12 times by 2 tests: INITIAL_STATE:case INITIAL_STATE:Executed by:
executed 12 times by 2 tests: case INITIAL_STATE:Executed by:
| 12 | ||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | int fd = open_safer (".", | - | ||||||||||||||||||
| 18 | 00 | - | ||||||||||||||||||
| 19 | ); | - | ||||||||||||||||||
| 20 | if (0 <= fd
| 2-10 | ||||||||||||||||||
| 21 | { | - | ||||||||||||||||||
| 22 | wd->state = FD_STATE; | - | ||||||||||||||||||
| 23 | wd->val.fd = fd; | - | ||||||||||||||||||
| 24 | break; executed 10 times by 2 tests: break;Executed by:
| 10 | ||||||||||||||||||
| 25 | } | - | ||||||||||||||||||
| 26 | if ( | - | ||||||||||||||||||
| 27 | (*
| 0-2 | ||||||||||||||||||
| 28 | !=
| 0-2 | ||||||||||||||||||
| 29 | 13
| 0-2 | ||||||||||||||||||
| 30 | && | - | ||||||||||||||||||
| 31 | (*
| 0 | ||||||||||||||||||
| 32 | !=
| 0 | ||||||||||||||||||
| 33 | 116
| 0 | ||||||||||||||||||
| 34 | ) | - | ||||||||||||||||||
| 35 | { | - | ||||||||||||||||||
| 36 | wd->state = ERROR_STATE; | - | ||||||||||||||||||
| 37 | wd->val.errnum = | - | ||||||||||||||||||
| 38 | (*__errno_location ()) | - | ||||||||||||||||||
| 39 | ; | - | ||||||||||||||||||
| 40 | break; never executed: break; | 0 | ||||||||||||||||||
| 41 | } | - | ||||||||||||||||||
| 42 | } | - | ||||||||||||||||||
| 43 | wd->state = FORKING_STATE; | - | ||||||||||||||||||
| 44 | wd->val.child = -1; | - | ||||||||||||||||||
| 45 | ((void) 0); | - | ||||||||||||||||||
| 46 | case executed 2 times by 1 test: FORKING_STATE:case FORKING_STATE:Executed by:
executed 2 times by 1 test: case FORKING_STATE:Executed by:
code before this statement executed 2 times by 1 test: case FORKING_STATE:Executed by:
| 2 | ||||||||||||||||||
| 47 | if (wd->val.child < 0
| 0-4 | ||||||||||||||||||
| 48 | { | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | wd->val.child = fork (); | - | ||||||||||||||||||
| 53 | if (wd->val.child != 0
| 0-4 | ||||||||||||||||||
| 54 | { | - | ||||||||||||||||||
| 55 | if (0 < wd->val.child
| 0-4 | ||||||||||||||||||
| 56 | return executed 4 times by 1 test: return 1 ;Executed by:
executed 4 times by 1 test: return 1 ;Executed by:
| 4 | ||||||||||||||||||
| 57 | 1 executed 4 times by 1 test: return 1 ;Executed by:
| 4 | ||||||||||||||||||
| 58 | ; executed 4 times by 1 test: return 1 ;Executed by:
| 4 | ||||||||||||||||||
| 59 | wd->state = ERROR_STATE; | - | ||||||||||||||||||
| 60 | wd->val.errnum = | - | ||||||||||||||||||
| 61 | (*__errno_location ()) | - | ||||||||||||||||||
| 62 | ; | - | ||||||||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||||||||
| 64 | } never executed: end of block | 0 | ||||||||||||||||||
| 65 | break; never executed: break; | 0 | ||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | case executed 3 times by 1 test: FD_STATE:case FD_STATE:Executed by:
executed 3 times by 1 test: case FD_STATE:Executed by:
| 3 | ||||||||||||||||||
| 68 | case executed 18 times by 2 tests: FD_POST_CHDIR_STATE:case FD_POST_CHDIR_STATE:Executed by:
executed 18 times by 2 tests: case FD_POST_CHDIR_STATE:Executed by:
| 18 | ||||||||||||||||||
| 69 | case never executed: ERROR_STATE:case ERROR_STATE:never executed: case ERROR_STATE: | 0 | ||||||||||||||||||
| 70 | case executed 12275 times by 2 tests: FINAL_STATE:case FINAL_STATE:Executed by:
executed 12275 times by 2 tests: case FINAL_STATE:Executed by:
| 12275 | ||||||||||||||||||
| 71 | break; executed 12296 times by 2 tests: break;Executed by:
| 12296 | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | ((0) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||
| 76 | "0" | - | ||||||||||||||||||
| 77 | , "lib/savewd.c", 99, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||
| 78 | ; | - | ||||||||||||||||||
| 79 | } never executed: end of block | 0 | ||||||||||||||||||
| 80 | - | |||||||||||||||||||
| 81 | return executed 12306 times by 2 tests: return 0 ;Executed by:
executed 12306 times by 2 tests: return 0 ;Executed by:
| 12306 | ||||||||||||||||||
| 82 | 0 executed 12306 times by 2 tests: return 0 ;Executed by:
| 12306 | ||||||||||||||||||
| 83 | ; executed 12306 times by 2 tests: return 0 ;Executed by:
| 12306 | ||||||||||||||||||
| 84 | } | - | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | int | - | ||||||||||||||||||
| 87 | savewd_chdir (struct savewd *wd, char const *dir, int options, | - | ||||||||||||||||||
| 88 | int open_result[2]) | - | ||||||||||||||||||
| 89 | { | - | ||||||||||||||||||
| 90 | int fd = -1; | - | ||||||||||||||||||
| 91 | int result = 0; | - | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | - | |||||||||||||||||||
| 95 | if (open_result
| 9-12310 | ||||||||||||||||||
| 96 | || (
| 172-12138 | ||||||||||||||||||
| 97 | { | - | ||||||||||||||||||
| 98 | fd = open (dir, | - | ||||||||||||||||||
| 99 | ( | - | ||||||||||||||||||
| 100 | 00 | - | ||||||||||||||||||
| 101 | | | - | ||||||||||||||||||
| 102 | 0200000 | - | ||||||||||||||||||
| 103 | | | - | ||||||||||||||||||
| 104 | 0400 | - | ||||||||||||||||||
| 105 | | | - | ||||||||||||||||||
| 106 | 04000 | - | ||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | | (options & SAVEWD_CHDIR_NOFOLLOW ? | - | ||||||||||||||||||
| 109 | 0400000 | - | ||||||||||||||||||
| 110 | : 0))); | - | ||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | if (open_result
| 9-12138 | ||||||||||||||||||
| 113 | { | - | ||||||||||||||||||
| 114 | open_result[0] = fd; | - | ||||||||||||||||||
| 115 | open_result[1] = | - | ||||||||||||||||||
| 116 | (*__errno_location ()) | - | ||||||||||||||||||
| 117 | ; | - | ||||||||||||||||||
| 118 | } executed 9 times by 2 tests: end of blockExecuted by:
| 9 | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | if (fd < 0
| 0-12147 | ||||||||||||||||||
| 121 | (*
| 0 | ||||||||||||||||||
| 122 | !=
| 0 | ||||||||||||||||||
| 123 | 13
| 0 | ||||||||||||||||||
| 124 | ) | - | ||||||||||||||||||
| 125 | result = -1; never executed: result = -1; | 0 | ||||||||||||||||||
| 126 | } executed 12147 times by 2 tests: end of blockExecuted by:
| 12147 | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | if (result == 0
| 0-12319 | ||||||||||||||||||
| 129 | { | - | ||||||||||||||||||
| 130 | if (savewd_save (wd)
| 4-12306 | ||||||||||||||||||
| 131 | { | - | ||||||||||||||||||
| 132 | open_result = | - | ||||||||||||||||||
| 133 | ((void *)0) | - | ||||||||||||||||||
| 134 | ; | - | ||||||||||||||||||
| 135 | result = -2; | - | ||||||||||||||||||
| 136 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 137 | else | - | ||||||||||||||||||
| 138 | { | - | ||||||||||||||||||
| 139 | result = (fd < 0
| 169-12137 | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | if (result == 0
| 1-12305 | ||||||||||||||||||
| 142 | switch (wd->state) | - | ||||||||||||||||||
| 143 | { | - | ||||||||||||||||||
| 144 | case executed 13 times by 2 tests: FD_STATE:case FD_STATE:Executed by:
executed 13 times by 2 tests: case FD_STATE:Executed by:
| 13 | ||||||||||||||||||
| 145 | wd->state = FD_POST_CHDIR_STATE; | - | ||||||||||||||||||
| 146 | break; executed 13 times by 2 tests: break;Executed by:
| 13 | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | case never executed: ERROR_STATE:case ERROR_STATE:never executed: case ERROR_STATE: | 0 | ||||||||||||||||||
| 149 | case executed 18 times by 2 tests: FD_POST_CHDIR_STATE:case FD_POST_CHDIR_STATE:Executed by:
executed 18 times by 2 tests: case FD_POST_CHDIR_STATE:Executed by:
| 18 | ||||||||||||||||||
| 150 | case executed 12274 times by 2 tests: FINAL_STATE:case FINAL_STATE:Executed by:
executed 12274 times by 2 tests: case FINAL_STATE:Executed by:
| 12274 | ||||||||||||||||||
| 151 | break; executed 12292 times by 2 tests: break;Executed by:
| 12292 | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | case never executed: FORKING_STATE:case FORKING_STATE:never executed: case FORKING_STATE: | 0 | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | (( | - | ||||||||||||||||||
| 156 | wd->val.child == 0 | - | ||||||||||||||||||
| 157 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||
| 158 | "wd->val.child == 0" | - | ||||||||||||||||||
| 159 | , "lib/savewd.c", 155, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||
| 160 | ; | - | ||||||||||||||||||
| 161 | break; never executed: break; | 0 | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | ((0) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||
| 166 | "0" | - | ||||||||||||||||||
| 167 | , "lib/savewd.c", 159, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||
| 168 | ; | - | ||||||||||||||||||
| 169 | } never executed: end of block | 0 | ||||||||||||||||||
| 170 | } executed 12306 times by 2 tests: end of blockExecuted by:
| 12306 | ||||||||||||||||||
| 171 | } | - | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | if (0 <= fd
| 9-12147 | ||||||||||||||||||
| 174 | { | - | ||||||||||||||||||
| 175 | int e = | - | ||||||||||||||||||
| 176 | (*__errno_location ()) | - | ||||||||||||||||||
| 177 | ; | - | ||||||||||||||||||
| 178 | close (fd); | - | ||||||||||||||||||
| 179 | - | |||||||||||||||||||
| 180 | (*__errno_location ()) | - | ||||||||||||||||||
| 181 | = e; | - | ||||||||||||||||||
| 182 | } executed 12138 times by 2 tests: end of blockExecuted by:
| 12138 | ||||||||||||||||||
| 183 | - | |||||||||||||||||||
| 184 | return executed 12319 times by 2 tests: result;return result;Executed by:
executed 12319 times by 2 tests: return result;Executed by:
| 12319 | ||||||||||||||||||
| 185 | } | - | ||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | int | - | ||||||||||||||||||
| 188 | savewd_restore (struct savewd *wd, int status) | - | ||||||||||||||||||
| 189 | { | - | ||||||||||||||||||
| 190 | switch (wd->state) | - | ||||||||||||||||||
| 191 | { | - | ||||||||||||||||||
| 192 | case executed 10013 times by 2 tests: INITIAL_STATE:case INITIAL_STATE:Executed by:
executed 10013 times by 2 tests: case INITIAL_STATE:Executed by:
| 10013 | ||||||||||||||||||
| 193 | case executed 2 times by 1 test: FD_STATE:case FD_STATE:Executed by:
executed 2 times by 1 test: case FD_STATE:Executed by:
| 2 | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | break; executed 10015 times by 2 tests: break;Executed by:
| 10015 | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | case executed 13 times by 2 tests: FD_POST_CHDIR_STATE:case FD_POST_CHDIR_STATE:Executed by:
executed 13 times by 2 tests: case FD_POST_CHDIR_STATE:Executed by:
| 13 | ||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | if (fchdir (wd->val.fd) == 0
| 0-13 | ||||||||||||||||||
| 201 | { | - | ||||||||||||||||||
| 202 | wd->state = FD_STATE; | - | ||||||||||||||||||
| 203 | break; executed 13 times by 2 tests: break;Executed by:
| 13 | ||||||||||||||||||
| 204 | } | - | ||||||||||||||||||
| 205 | else | - | ||||||||||||||||||
| 206 | { | - | ||||||||||||||||||
| 207 | int chdir_errno = | - | ||||||||||||||||||
| 208 | (*__errno_location ()) | - | ||||||||||||||||||
| 209 | ; | - | ||||||||||||||||||
| 210 | close (wd->val.fd); | - | ||||||||||||||||||
| 211 | wd->state = ERROR_STATE; | - | ||||||||||||||||||
| 212 | wd->val.errnum = chdir_errno; | - | ||||||||||||||||||
| 213 | } never executed: end of block | 0 | ||||||||||||||||||
| 214 | ((void) 0); | - | ||||||||||||||||||
| 215 | case never executed: ERROR_STATE:case ERROR_STATE:never executed: case ERROR_STATE:code before this statement never executed: case ERROR_STATE: | 0 | ||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | (*__errno_location ()) | - | ||||||||||||||||||
| 219 | = wd->val.errnum; | - | ||||||||||||||||||
| 220 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | case executed 4 times by 1 test: FORKING_STATE:case FORKING_STATE:Executed by:
executed 4 times by 1 test: case FORKING_STATE:Executed by:
| 4 | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | - | |||||||||||||||||||
| 225 | { | - | ||||||||||||||||||
| 226 | pid_t child = wd->val.child; | - | ||||||||||||||||||
| 227 | if (child == 0
| 0-4 | ||||||||||||||||||
| 228 | _exit (status); never executed: _exit (status); | 0 | ||||||||||||||||||
| 229 | if (0 < child
| 0-4 | ||||||||||||||||||
| 230 | { | - | ||||||||||||||||||
| 231 | int child_status; | - | ||||||||||||||||||
| 232 | while (waitpid (child, &child_status, 0) < 0
| 0-4 | ||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | (((* never executed: __errno_location ()) (((*__errno_location ()) == 4) ? (void) (0) : __assert_fail ( "(*__errno_location ()) == 4" , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) ;never executed: (((*__errno_location ()) == 4) ? (void) (0) : __assert_fail ( "(*__errno_location ()) == 4" , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) ; | 0 | ||||||||||||||||||
| 235 | == never executed: (((*__errno_location ()) == 4) ? (void) (0) : __assert_fail ( "(*__errno_location ()) == 4" , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) ; | 0 | ||||||||||||||||||
| 236 | 4) ? (void) (0) : __assert_fail ( never executed: (((*__errno_location ()) == 4) ? (void) (0) : __assert_fail ( "(*__errno_location ()) == 4" , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) ; | 0 | ||||||||||||||||||
| 237 | "(*__errno_location ()) == 4" never executed: (((*__errno_location ()) == 4) ? (void) (0) : __assert_fail ( "(*__errno_location ()) == 4" , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) ; | 0 | ||||||||||||||||||
| 238 | , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) never executed: (((*__errno_location ()) == 4) ? (void) (0) : __assert_fail ( "(*__errno_location ()) == 4" , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) ; | 0 | ||||||||||||||||||
| 239 | ; never executed: (((*__errno_location ()) == 4) ? (void) (0) : __assert_fail ( "(*__errno_location ()) == 4" , "lib/savewd.c", 216, __PRETTY_FUNCTION__)) ; | 0 | ||||||||||||||||||
| 240 | wd->val.child = -1; | - | ||||||||||||||||||
| 241 | if (!
| 0-4 | ||||||||||||||||||
| 242 | (((
| 0-4 | ||||||||||||||||||
| 243 | child_status
| 0-4 | ||||||||||||||||||
| 244 | ) & 0x7f) == 0)
| 0-4 | ||||||||||||||||||
| 245 | ) | - | ||||||||||||||||||
| 246 | raise ( never executed: raise ( (( child_status ) & 0x7f) ); | 0 | ||||||||||||||||||
| 247 | (( never executed: raise ( (( child_status ) & 0x7f) ); | 0 | ||||||||||||||||||
| 248 | child_status never executed: raise ( (( child_status ) & 0x7f) ); | 0 | ||||||||||||||||||
| 249 | ) & 0x7f) never executed: raise ( (( child_status ) & 0x7f) ); | 0 | ||||||||||||||||||
| 250 | ); never executed: raise ( (( child_status ) & 0x7f) ); | 0 | ||||||||||||||||||
| 251 | return executed 4 times by 1 test: return ((( child_status ) & 0xff00) >> 8) ;Executed by:
executed 4 times by 1 test: return ((( child_status ) & 0xff00) >> 8) ;Executed by:
| 4 | ||||||||||||||||||
| 252 | ((( executed 4 times by 1 test: return ((( child_status ) & 0xff00) >> 8) ;Executed by:
| 4 | ||||||||||||||||||
| 253 | child_status executed 4 times by 1 test: return ((( child_status ) & 0xff00) >> 8) ;Executed by:
| 4 | ||||||||||||||||||
| 254 | ) & 0xff00) >> 8) executed 4 times by 1 test: return ((( child_status ) & 0xff00) >> 8) ;Executed by:
| 4 | ||||||||||||||||||
| 255 | ; executed 4 times by 1 test: return ((( child_status ) & 0xff00) >> 8) ;Executed by:
| 4 | ||||||||||||||||||
| 256 | } | - | ||||||||||||||||||
| 257 | } | - | ||||||||||||||||||
| 258 | break; never executed: break; | 0 | ||||||||||||||||||
| 259 | - | |||||||||||||||||||
| 260 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | ((0) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||
| 263 | "0" | - | ||||||||||||||||||
| 264 | , "lib/savewd.c", 226, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||
| 265 | ; | - | ||||||||||||||||||
| 266 | } never executed: end of block | 0 | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | return executed 10028 times by 2 tests: 0;return 0;Executed by:
executed 10028 times by 2 tests: return 0;Executed by:
| 10028 | ||||||||||||||||||
| 269 | } | - | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | void | - | ||||||||||||||||||
| 272 | savewd_finish (struct savewd *wd) | - | ||||||||||||||||||
| 273 | { | - | ||||||||||||||||||
| 274 | switch (wd->state) | - | ||||||||||||||||||
| 275 | { | - | ||||||||||||||||||
| 276 | case executed 247 times by 2 tests: INITIAL_STATE:case INITIAL_STATE:Executed by:
executed 247 times by 2 tests: case INITIAL_STATE:Executed by:
| 247 | ||||||||||||||||||
| 277 | case never executed: ERROR_STATE:case ERROR_STATE:never executed: case ERROR_STATE: | 0 | ||||||||||||||||||
| 278 | break; executed 247 times by 2 tests: break;Executed by:
| 247 | ||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | case executed 10 times by 2 tests: FD_STATE:case FD_STATE:Executed by:
executed 10 times by 2 tests: case FD_STATE:Executed by:
| 10 | ||||||||||||||||||
| 281 | case never executed: FD_POST_CHDIR_STATE:case FD_POST_CHDIR_STATE:never executed: case FD_POST_CHDIR_STATE: | 0 | ||||||||||||||||||
| 282 | close (wd->val.fd); | - | ||||||||||||||||||
| 283 | break; executed 10 times by 2 tests: break;Executed by:
| 10 | ||||||||||||||||||
| 284 | - | |||||||||||||||||||
| 285 | case executed 2 times by 1 test: FORKING_STATE:case FORKING_STATE:Executed by:
executed 2 times by 1 test: case FORKING_STATE:Executed by:
| 2 | ||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | (( | - | ||||||||||||||||||
| 288 | wd->val.child < 0 | - | ||||||||||||||||||
| 289 | ) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||
| 290 | "wd->val.child < 0" | - | ||||||||||||||||||
| 291 | , "lib/savewd.c", 247, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||
| 292 | ; | - | ||||||||||||||||||
| 293 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | ((0) ? (void) (0) : __assert_fail ( | - | ||||||||||||||||||
| 298 | "0" | - | ||||||||||||||||||
| 299 | , "lib/savewd.c", 251, __PRETTY_FUNCTION__)) | - | ||||||||||||||||||
| 300 | ; | - | ||||||||||||||||||
| 301 | } never executed: end of block | 0 | ||||||||||||||||||
| 302 | - | |||||||||||||||||||
| 303 | wd->state = FINAL_STATE; | - | ||||||||||||||||||
| 304 | } executed 259 times by 2 tests: end of blockExecuted by:
| 259 | ||||||||||||||||||
| 305 | static | - | ||||||||||||||||||
| 306 | _Bool | - | ||||||||||||||||||
| 307 | - | |||||||||||||||||||
| 308 | savewd_delegating (struct savewd const *wd) | - | ||||||||||||||||||
| 309 | { | - | ||||||||||||||||||
| 310 | return executed 10027 times by 2 tests: wd->state == FORKING_STATE && 0 < wd->val.child;return wd->state == FORKING_STATE && 0 < wd->val.child;Executed by:
executed 10027 times by 2 tests: return wd->state == FORKING_STATE && 0 < wd->val.child;Executed by:
| 10027 | ||||||||||||||||||
| 311 | } | - | ||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | int | - | ||||||||||||||||||
| 314 | savewd_process_files (int n_files, char **file, | - | ||||||||||||||||||
| 315 | int (*act) (char *, struct savewd *, void *), | - | ||||||||||||||||||
| 316 | void *options) | - | ||||||||||||||||||
| 317 | { | - | ||||||||||||||||||
| 318 | int i = 0; | - | ||||||||||||||||||
| 319 | int last_relative; | - | ||||||||||||||||||
| 320 | int exit_status = | - | ||||||||||||||||||
| 321 | 0 | - | ||||||||||||||||||
| 322 | ; | - | ||||||||||||||||||
| 323 | struct savewd wd; | - | ||||||||||||||||||
| 324 | savewd_init (&wd); | - | ||||||||||||||||||
| 325 | - | |||||||||||||||||||
| 326 | for (last_relative = n_files - 1; 0 <= last_relative
| 0-254 | ||||||||||||||||||
| 327 | if (! ((((
| 0-254 | ||||||||||||||||||
| 328 | break; executed 254 times by 2 tests: break;Executed by:
| 254 | ||||||||||||||||||
| 329 | - | |||||||||||||||||||
| 330 | for (; i < last_relative
| 254-10027 | ||||||||||||||||||
| 331 | { | - | ||||||||||||||||||
| 332 | if (! savewd_delegating (&wd)
| 0-10027 | ||||||||||||||||||
| 333 | { | - | ||||||||||||||||||
| 334 | int s = act (file[i], &wd, options); | - | ||||||||||||||||||
| 335 | if (exit_status < s
| 0-10027 | ||||||||||||||||||
| 336 | exit_status = s; never executed: exit_status = s; | 0 | ||||||||||||||||||
| 337 | } executed 10027 times by 2 tests: end of blockExecuted by:
| 10027 | ||||||||||||||||||
| 338 | - | |||||||||||||||||||
| 339 | if (! ((((
| 0-10027 | ||||||||||||||||||
| 340 | { | - | ||||||||||||||||||
| 341 | int r = savewd_restore (&wd, exit_status); | - | ||||||||||||||||||
| 342 | if (exit_status < r
| 1-10026 | ||||||||||||||||||
| 343 | exit_status = r; executed 1 time by 1 test: exit_status = r;Executed by:
| 1 | ||||||||||||||||||
| 344 | } executed 10027 times by 2 tests: end of blockExecuted by:
| 10027 | ||||||||||||||||||
| 345 | } executed 10027 times by 2 tests: end of blockExecuted by:
| 10027 | ||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 | savewd_finish (&wd); | - | ||||||||||||||||||
| 348 | - | |||||||||||||||||||
| 349 | for (; i < n_files
| 254 | ||||||||||||||||||
| 350 | { | - | ||||||||||||||||||
| 351 | int s = act (file[i], &wd, options); | - | ||||||||||||||||||
| 352 | if (exit_status < s
| 0-254 | ||||||||||||||||||
| 353 | exit_status = s; never executed: exit_status = s; | 0 | ||||||||||||||||||
| 354 | } executed 254 times by 2 tests: end of blockExecuted by:
| 254 | ||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | return executed 254 times by 2 tests: exit_status;return exit_status;Executed by:
executed 254 times by 2 tests: return exit_status;Executed by:
| 254 | ||||||||||||||||||
| 357 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |