| 682 | } |
| 683 | |
| 684 | static bool private_runtime_snapshot(int fd, const char *path, bool require_empty_acl, |
| 685 | struct stat *status_out) { |
| 686 | struct stat by_handle; |
| 687 | struct stat by_path; |
| 688 | bool valid = fd >= 0 && path && path[0] != '\0' && fstat(fd, &by_handle) == 0 && |
| 689 | lstat(path, &by_path) == 0 && S_ISDIR(by_handle.st_mode) && |
| 690 | S_ISDIR(by_path.st_mode) && by_handle.st_uid == geteuid() && |
| 691 | by_path.st_uid == geteuid() && (by_handle.st_mode & 07777) == 0700 && |
| 692 | (by_path.st_mode & 07777) == 0700 && by_handle.st_dev == by_path.st_dev && |
| 693 | by_handle.st_ino == by_path.st_ino && |
| 694 | (!require_empty_acl || cbm_macos_extended_acl_fd_is_empty(fd)); |
| 695 | if (valid && status_out) { |
| 696 | *status_out = by_handle; |
| 697 | } |
| 698 | return valid; |
| 699 | } |
| 700 | |
| 701 | static int private_directory_tree_open(const char *directory_path); |
| 702 |
no test coverage detected