Repair only a concrete fixed-drive path with a conclusive local "not found" * result. Bare/relative/templated commands and filesystem errors remain * fail-closed. POSIX never enters this classifier. */
| 2185 | * result. Bare/relative/templated commands and filesystem errors remain |
| 2186 | * fail-closed. POSIX never enters this classifier. */ |
| 2187 | static cbm_json_mcp_command_availability_t cbm_json_mcp_command_availability(const char *command) { |
| 2188 | if (!cbm_json_mcp_command_path_probe_safe(command) || strchr(command, '$') || |
| 2189 | strchr(command, '%')) { |
| 2190 | return CBM_JSON_MCP_COMMAND_UNKNOWN; |
| 2191 | } |
| 2192 | cbm_json_mcp_command_availability_t availability = cbm_json_mcp_probe_command_path(command); |
| 2193 | if (availability != CBM_JSON_MCP_COMMAND_MISSING) { |
| 2194 | return availability; |
| 2195 | } |
| 2196 | const char *slash = strrchr(command, '/'); |
| 2197 | const char *backslash = strrchr(command, '\\'); |
| 2198 | const char *basename = slash && backslash |
| 2199 | ? (slash > backslash ? slash + 1 : backslash + 1) |
| 2200 | : (slash ? slash + 1 : (backslash ? backslash + 1 : command)); |
| 2201 | if (!basename[0] || strchr(basename, '.')) { |
| 2202 | return CBM_JSON_MCP_COMMAND_MISSING; |
| 2203 | } |
| 2204 | /* An extensionless command can resolve through a client-specific or |
| 2205 | * custom PATHEXT suffix that is not present in the installer's process. |
| 2206 | * Absence of the literal file therefore never proves absence of the |
| 2207 | * command. Preserve it unless positive prior-image identity matched. */ |
| 2208 | availability = CBM_JSON_MCP_COMMAND_UNKNOWN; |
| 2209 | return availability; |
| 2210 | } |
| 2211 | #endif |
| 2212 | |
| 2213 | static int cbm_json_mcp_snapshot_ownership(const char *document, size_t document_length, |
no test coverage detected