diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-22 15:58:34 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-22 15:58:34 +0000 |
commit | 40d9eb14dfb842c51e9f86818b43ae7711e1a5d6 (patch) | |
tree | bf7f5cbee76a95e72682c5f65baecad4d6173ce0 /src/libutil/util.cc | |
parent | 7a02d954186d6ba1ea41d9917d63f9fab84736b3 (diff) |
* Fix the garbage collector.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 6a032a3f1..60b86b162 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -6,6 +6,7 @@ #include <sys/stat.h> #include <unistd.h> #include <dirent.h> +#include <fcntl.h> #include "util.hh" @@ -192,6 +193,16 @@ Path createTempDir() } +void writeStringToFile(const Path & path, const string & s) +{ + AutoCloseFD fd = open(path.c_str(), + O_CREAT | O_EXCL | O_WRONLY, 0666); + if (fd == -1) + throw SysError(format("creating file `%1%'") % path); + writeFull(fd, (unsigned char *) s.c_str(), s.size()); +} + + Verbosity verbosity = lvlError; static int nestingLevel = 0; |