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. */
| 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. */ |
| 1886 | static 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 | |
| 1897 | static void th_allowed_root_restore(const th_allowed_root_saved_t *saved) { |
| 1898 | if (saved->was_set) { |
no test coverage detected