The write_nonblock() variant is safer here as it allows to let the
callers deal with short writes.
Despite the name, write_nonblock() can be used for both blocking and
non-blocking fds. It will be renamed in a subsequent patch.
memcpy(remainder, buf + l1, len - l1);
RC4(&scc->send->key, len - l1, remainder, tmp + l1);
}
- ret = write_all(scc->fd, (char *)tmp, len);
+ ret = write_nonblock(scc->fd, (char *)tmp, len);
free(tmp);
return ret;
}
gret = gcry_cipher_encrypt(scc->send->handle, tmp, size,
(unsigned char *)buf, size);
assert(gret == 0);
- ret = write_all(scc->fd, (char *)tmp, size);
+ ret = write_nonblock(scc->fd, (char *)tmp, size);
free(tmp);
return ret;
}