MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / bootstrap_start_failure_parse

Function bootstrap_start_failure_parse

src/daemon/bootstrap.c:417–443  ·  view source on GitHub ↗

Parse one "v1\tts\tpid\truntime_dir\tcomponent\tstage\terrno\tpath" line * (line is NUL-terminated, newline already stripped, and is modified). */

Source from the content-addressed store, hash-verified

415/* Parse one "v1\tts\tpid\truntime_dir\tcomponent\tstage\terrno\tpath" line
416 * (line is NUL-terminated, newline already stripped, and is modified). */
417static 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
445static FILE *bootstrap_start_failure_open(const char *log_directory, int *status_out) {
446 char path[BOOTSTRAP_PATH_CAP];

Calls

no outgoing calls

Tested by

no test coverage detected