| 701 | static int private_directory_tree_open(const char *directory_path); |
| 702 | |
| 703 | static bool private_runtime_open(const char *path, int *fd_out, dev_t *device_out, |
| 704 | ino_t *inode_out) { |
| 705 | if (!path || !fd_out || !device_out || !inode_out) { |
| 706 | return false; |
| 707 | } |
| 708 | |
| 709 | int fd = private_directory_tree_open(path); |
| 710 | if (fd < 0) { |
| 711 | return false; |
| 712 | } |
| 713 | |
| 714 | struct stat before; |
| 715 | bool secured = private_runtime_snapshot(fd, path, true, &before); |
| 716 | if (!secured) { |
| 717 | (void)close(fd); |
| 718 | return false; |
| 719 | } |
| 720 | *fd_out = fd; |
| 721 | *device_out = before.st_dev; |
| 722 | *inode_out = before.st_ino; |
| 723 | return true; |
| 724 | } |
| 725 | |
| 726 | static bool endpoint_runtime_still_valid(const cbm_daemon_ipc_endpoint_t *endpoint) { |
| 727 | if (!endpoint || endpoint->dir_fd < 0) { |
no test coverage detected