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

Function hl_make_root

tests/test_cli.c:16083–16096  ·  view source on GitHub ↗

A fresh synthetic root with its links resolved. The kernel bounds the * EXPANDED path, and macOS /tmp is a link to /private/tmp: under the link a * near-1 KiB path can be neither created nor probed, which hides the very * cut-off file these tests look for. */

Source from the content-addressed store, hash-verified

16081 * near-1 KiB path can be neither created nor probed, which hides the very
16082 * cut-off file these tests look for. */
16083static bool hl_make_root(char *root, size_t root_sz) {
16084 char tmpl[256];
16085 char real[4096];
16086 snprintf(tmpl, sizeof(tmpl), "/tmp/cbm-hooklog-XXXXXX");
16087 if (!cbm_mkdtemp(tmpl)) {
16088 return false;
16089 }
16090 if (!cbm_canonical_path(tmpl, real, sizeof(real))) {
16091 th_rmtree(tmpl);
16092 return false;
16093 }
16094 int n = snprintf(root, root_sz, "%s", real);
16095 return n > 0 && (size_t)n < root_sz;
16096}
16097
16098/* "<root>/hhh…/hhh…" of exactly `len` bytes, every component short of
16099 * NAME_MAX. False when it cannot be built. */

Callers 1

test_cli.cFile · 0.85

Calls 3

cbm_mkdtempFunction · 0.85
cbm_canonical_pathFunction · 0.85
th_rmtreeFunction · 0.85

Tested by

no test coverage detected