| 7634 | } |
| 7635 | |
| 7636 | static int config_index_policy_write(cbm_config_t *config, const char *key, const char *value) { |
| 7637 | cbm_index_resource_policy_t candidate; |
| 7638 | cbm_index_policy_init(&candidate); |
| 7639 | char error[CLI_BUF_256]; |
| 7640 | if (!cbm_index_policy_set(&candidate, key, value, error, sizeof(error))) { |
| 7641 | (void)fprintf(stderr, "error: %s\n", error); |
| 7642 | return CLI_ERR; |
| 7643 | } |
| 7644 | int rc = cbm_config_set(config, key, value); |
| 7645 | if (rc != 0) { |
| 7646 | /* The caller suppresses its own message for policy keys because this |
| 7647 | * helper names the precise reason. That is only true if the helper |
| 7648 | * speaks on every failure it can return: a validated value whose write |
| 7649 | * then fails -- a locked or read-only _config.db -- used to exit |
| 7650 | * non-zero having printed nothing at all. */ |
| 7651 | (void)fprintf(stderr, "error: failed to set %s\n", key); |
| 7652 | } |
| 7653 | return rc; |
| 7654 | } |
| 7655 | |
| 7656 | static void config_ui_read(const char *key, char *out, size_t out_sz) { |
| 7657 | cbm_ui_config_t ui; |
no test coverage detected