| 154 | } |
| 155 | |
| 156 | bool can_execute(const std::string &path) |
| 157 | { |
| 158 | int fd = open(path.c_str(), O_RDONLY); |
| 159 | if (fd < 0) |
| 160 | return false; |
| 161 | char header[2] = {0}; |
| 162 | int nread = read(fd, reinterpret_cast<void *>(&header), sizeof(header)); |
| 163 | close(fd); |
| 164 | if (nread < 0) |
| 165 | return false; |
| 166 | return header[0] == 'M' && header[1] == 'Z'; |
| 167 | } |
| 168 | } // namespace file_system |
| 169 | } // namespace cs_impl |
| 170 |