]> git.sesse.net Git - cubemap/blob - util.h
Do not crash on re-exec if we do not have an access log.
[cubemap] / util.h
1 #ifndef _UTIL_H
2 #define _UTIL_H
3
4 // Some utilities for reading and writing to temporary files.
5
6 #include <string>
7
8 // Make a file in /tmp, unlink it, and write <contents> to it.
9 // Returns the opened file descriptor, or -1 on failure.
10 int make_tempfile(const std::string &contents);
11
12 // Opposite of make_tempfile(). Returns false on failure.
13 bool read_tempfile_and_close(int fd, std::string *contents);
14
15 // Same as read_tempfile_and_close(), without the close.
16 bool read_tempfile(int fd, std::string *contents);
17
18 #endif  // !defined(_UTIL_H