1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00

printMsg(): Don't check for interrupts

Having the logger function potentially throw exceptions is
Heisenbuggy.
This commit is contained in:
Eelco Dolstra 2016-09-16 18:52:42 +02:00
parent 2e1493037b
commit 054be50257
3 changed files with 15 additions and 17 deletions

View file

@ -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);
}