| 2177 | } |
| 2178 | |
| 2179 | bool SafeWriteToFile(const std::string &content, |
| 2180 | const std::string &path, |
| 2181 | int mode) { |
| 2182 | const int fd = open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, mode); |
| 2183 | if (fd < 0) |
| 2184 | return false; |
| 2185 | const bool retval = SafeWrite(fd, content.data(), content.size()); |
| 2186 | close(fd); |
| 2187 | return retval; |
| 2188 | } |
| 2189 | |
| 2190 | |
| 2191 | #ifdef CVMFS_NAMESPACE_GUARD |