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