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

Function artifact_snapshot_tmp_open

src/pipeline/artifact.c:443–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441} artifact_snapshot_tmp_t;
442
443static bool artifact_snapshot_tmp_open(artifact_snapshot_tmp_t *tmp) {
444 tmp->dir[0] = '\0';
445 tmp->db[0] = '\0';
446 int written = snprintf(tmp->dir, sizeof(tmp->dir), "%s/cbm-artifact-XXXXXX", cbm_tmpdir());
447 if (written <= 0 || (size_t)written >= sizeof(tmp->dir) || !cbm_mkdtemp(tmp->dir)) {
448 tmp->dir[0] = '\0';
449 return false;
450 }
451 written = snprintf(tmp->db, sizeof(tmp->db), "%s/snapshot.db", tmp->dir);
452 if (written <= 0 || (size_t)written >= sizeof(tmp->db)) {
453 (void)cbm_rmdir(tmp->dir);
454 tmp->dir[0] = '\0';
455 return false;
456 }
457 return true;
458}
459
460/* Anchored cleanup — every exit from prepare_snapshot_db runs this, so neither
461 * the copy nor its WAL/SHM sidecars outlive the export. Removing the directory

Callers 1

prepare_snapshot_dbFunction · 0.85

Calls 3

cbm_tmpdirFunction · 0.85
cbm_mkdtempFunction · 0.85
cbm_rmdirFunction · 0.85

Tested by

no test coverage detected