Fix bogus handling of short writes.

This commit is contained in:
mycroft 1993-08-01 00:06:15 +00:00
parent 5b11c06adf
commit 3d297ded4f
1 changed files with 2 additions and 2 deletions

View File

@ -217,8 +217,8 @@ deliver(fd, name, lockfile)
}
while ((nr = read(fd, buf, sizeof(buf))) > 0)
for (off = 0; off < nr; nr -= nw, off += nw)
if ((nw = write(mbfd, buf + off, nr)) < 0) {
for (off = 0; off < nr; off += nw)
if ((nw = write(mbfd, buf + off, nr - off)) < 0) {
err(NOTFATAL, "%s: %s", path, strerror(errno));
goto trunc;
}