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

Function th_allowed_root_set

tests/test_httpd.c:1886–1895  ·  view source on GitHub ↗

Set (or, with NULL, clear) CBM_ALLOWED_ROOT and remember the previous value * so the test can put it back before asserting — a failed assertion returns * early, and a boundary left behind would leak into every later test. */

Source from the content-addressed store, hash-verified

1884 * so the test can put it back before asserting — a failed assertion returns
1885 * early, and a boundary left behind would leak into every later test. */
1886static void th_allowed_root_set(th_allowed_root_saved_t *saved, const char *value) {
1887 const char *current = getenv("CBM_ALLOWED_ROOT");
1888 saved->was_set = current != NULL;
1889 snprintf(saved->value, sizeof(saved->value), "%s", current ? current : "");
1890 if (value) {
1891 cbm_setenv("CBM_ALLOWED_ROOT", value, 1);
1892 } else {
1893 cbm_unsetenv("CBM_ALLOWED_ROOT");
1894 }
1895}
1896
1897static void th_allowed_root_restore(const th_allowed_root_saved_t *saved) {
1898 if (saved->was_set) {

Callers 1

test_httpd.cFile · 0.85

Calls 2

cbm_setenvFunction · 0.85
cbm_unsetenvFunction · 0.85

Tested by

no test coverage detected