| 169 | } |
| 170 | |
| 171 | void IPCSignalWatcher::openExecutable(const std::string& path) |
| 172 | { |
| 173 | const int fd = ::open(path.c_str(), O_RDONLY); |
| 174 | |
| 175 | if (fd < 0) { |
| 176 | throw ErrnoException("openExecutable", path, errno); |
| 177 | } |
| 178 | |
| 179 | struct ::stat st = { }; |
| 180 | |
| 181 | if (::fstat(fd, &st) != 0) { |
| 182 | ::close(fd); |
| 183 | throw ErrnoException("openExecutable", path, errno); |
| 184 | } |
| 185 | |
| 186 | if (!S_ISREG(st.st_mode) || !(st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) { |
| 187 | ::close(fd); |
| 188 | throw Exception("openExecutable", path, "not an executable file"); |
| 189 | } |
| 190 | |
| 191 | _exec_path = path; |
| 192 | _exec_path_fd = fd; |
| 193 | } |
| 194 | |
| 195 | void IPCSignalWatcher::closeExecutable() |
| 196 | { |
nothing calls this directly
no test coverage detected