Fix check for EINTR

This commit is contained in:
Matt Johnston 2014-01-28 22:44:24 +08:00
parent 2bc9f35052
commit af524c4d65

View File

@ -26,7 +26,7 @@ static int buf_writefile(buffer * buf, const char * filename) {
while (buf->pos != buf->len) { while (buf->pos != buf->len) {
int len = write(fd, buf_getptr(buf, buf->len - buf->pos), int len = write(fd, buf_getptr(buf, buf->len - buf->pos),
buf->len - buf->pos); buf->len - buf->pos);
if (errno == EINTR) { if (len == -1 && errno == EINTR) {
continue; continue;
} }
if (len <= 0) { if (len <= 0) {