diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-16T16·52+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-16T16·52+0200 |
commit | 054be5025762c5e1c7e853c4fa5d7eed8da1727f (patch) | |
tree | c5bf9e3b3125bbffd8e05538ac39c5bd383badb7 /src/libutil/util.cc | |
parent | 2e1493037b06eb97bf9e07693a974afadbf94386 (diff) |
printMsg(): Don't check for interrupts
Having the logger function potentially throw exceptions is Heisenbuggy.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 87e97c20fa3d..8e029fb4874a 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -474,24 +474,24 @@ void readFull(int fd, unsigned char * buf, size_t count) } -void writeFull(int fd, const unsigned char * buf, size_t count) +void writeFull(int fd, const unsigned char * buf, size_t count, bool allowInterrupts) { while (count) { - checkInterrupt(); ssize_t res = write(fd, (char *) buf, count); - if (res == -1) { - if (errno == EINTR) continue; + if (res == -1 && errno != EINTR) throw SysError("writing to file"); + if (res > 0) { + count -= res; + buf += res; } - count -= res; - buf += res; + if (allowInterrupts) checkInterrupt(); } } -void writeFull(int fd, const string & s) +void writeFull(int fd, const string & s, bool allowInterrupts) { - writeFull(fd, (const unsigned char *) s.data(), s.size()); + writeFull(fd, (const unsigned char *) s.data(), s.size(), allowInterrupts); } |