| 873 | static int private_directory_tree_open(const char *directory_path); |
| 874 | |
| 875 | static bool private_runtime_open(const char *path, int *fd_out, dev_t *device_out, |
| 876 | ino_t *inode_out) { |
| 877 | if (!path || !fd_out || !device_out || !inode_out) { |
| 878 | return false; |
| 879 | } |
| 880 | |
| 881 | int fd = private_directory_tree_open(path); |
| 882 | if (fd < 0) { |
| 883 | return false; |
| 884 | } |
| 885 | |
| 886 | struct stat before; |
| 887 | bool secured = private_runtime_snapshot(fd, path, true, &before); |
| 888 | if (!secured) { |
| 889 | (void)close(fd); |
| 890 | return false; |
| 891 | } |
| 892 | *fd_out = fd; |
| 893 | *device_out = before.st_dev; |
| 894 | *inode_out = before.st_ino; |
| 895 | return true; |
| 896 | } |
| 897 | |
| 898 | static bool endpoint_runtime_still_valid(const cbm_daemon_ipc_endpoint_t *endpoint) { |
| 899 | if (!endpoint || endpoint->dir_fd < 0) { |
no test coverage detected