Parse one "v1\tts\tpid\truntime_dir\tcomponent\tstage\terrno\tpath" line * (line is NUL-terminated, newline already stripped, and is modified). */
| 415 | /* Parse one "v1\tts\tpid\truntime_dir\tcomponent\tstage\terrno\tpath" line |
| 416 | * (line is NUL-terminated, newline already stripped, and is modified). */ |
| 417 | static bool bootstrap_start_failure_parse(char *line, char **runtime_dir_out, |
| 418 | cbm_daemon_bootstrap_start_failure_t *out) { |
| 419 | char *fields[8]; |
| 420 | size_t count = 0; |
| 421 | char *cursor = line; |
| 422 | while (count < 8) { |
| 423 | fields[count++] = cursor; |
| 424 | char *tab = strchr(cursor, '\t'); |
| 425 | if (!tab) { |
| 426 | break; |
| 427 | } |
| 428 | *tab = '\0'; |
| 429 | cursor = tab + 1; |
| 430 | } |
| 431 | if (count != 8 || strcmp(fields[0], "v1") != 0) { |
| 432 | return false; |
| 433 | } |
| 434 | memset(out, 0, sizeof(*out)); |
| 435 | out->recorded_at_s = strtoull(fields[1], NULL, 10); |
| 436 | out->pid = strtoull(fields[2], NULL, 10); |
| 437 | *runtime_dir_out = fields[3]; |
| 438 | (void)snprintf(out->component, sizeof(out->component), "%s", fields[4]); |
| 439 | (void)snprintf(out->stage, sizeof(out->stage), "%s", fields[5]); |
| 440 | out->errno_value = (int)strtol(fields[6], NULL, 10); |
| 441 | (void)snprintf(out->path, sizeof(out->path), "%s", fields[7]); |
| 442 | return true; |
| 443 | } |
| 444 | |
| 445 | static FILE *bootstrap_start_failure_open(const char *log_directory, int *status_out) { |
| 446 | char path[BOOTSTRAP_PATH_CAP]; |
no outgoing calls
no test coverage detected