| 51 | } |
| 52 | |
| 53 | void TempRulesFile::OverwriteContents(const std::string& contents) { |
| 54 | FILE* handle = fopen(name(), "w"); |
| 55 | if (handle == NULL) { |
| 56 | std::cout << "Error creating temp file; " << strerror(errno) << std::endl; |
| 57 | abort(); |
| 58 | } |
| 59 | int status = fputs(contents.c_str(), handle); |
| 60 | if (status < 0) { |
| 61 | std::cout << "Error writing to temp file; " << strerror(errno) << std::endl; |
| 62 | abort(); |
| 63 | } |
| 64 | status = fclose(handle); |
| 65 | if (status != 0) { |
| 66 | std::cout << "Error closing temp file; " << strerror(errno) << std::endl; |
| 67 | abort(); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | unsigned int RandSeed() { |
| 72 | struct timespec now; |