| 299 | } root_status_t; |
| 300 | |
| 301 | static root_status_t root_status(const char *root_path, int *out_errno) { |
| 302 | *out_errno = 0; |
| 303 | if (!root_path) { |
| 304 | return ROOT_UNCERTAIN; |
| 305 | } |
| 306 | struct stat st; |
| 307 | if (stat(root_path, &st) == 0) { |
| 308 | /* Exists but is no longer a directory → the root directory is gone. */ |
| 309 | return S_ISDIR(st.st_mode) ? ROOT_PRESENT : ROOT_MISSING; |
| 310 | } |
| 311 | *out_errno = errno; |
| 312 | return cbm_watcher_root_missing_errno(errno) ? ROOT_MISSING : ROOT_UNCERTAIN; |
| 313 | } |
| 314 | |
| 315 | /* Sustained-absence window (seconds) before a missing root may be pruned. |
| 316 | * Generous default: 10 minutes. Override with CBM_WATCHER_PRUNE_GRACE_S |
no test coverage detected