memcpy(remainder, buf + l1, len - l1);
RC4(&scc->send->key, len - l1, remainder, tmp + l1);
}
- ret = write_nonblock(scc->fd, (char *)tmp, len);
+ ret = xwrite(scc->fd, (char *)tmp, len);
free(tmp);
return ret;
}
static void dccp_send_fec(struct sender_client *sc, char *buf, size_t len)
{
- int ret = write_nonblock(sc->fd, buf, len);
+ int ret = xwrite(sc->fd, buf, len);
if (ret < 0)
dccp_shutdown_client(sc);
* len indicates that some bytes have been written but the next write would
* block.
*/
-int write_nonblock(int fd, const char *buf, size_t len)
+int xwrite(int fd, const char *buf, size_t len)
{
size_t written = 0;
* \param buf The buffer to be sent.
* \param len The length of \a buf.
*
- * This is like \ref write_nonblock() but returns \p -E_SHORT_WRITE if not
+ * This is like \ref xwrite() but returns \p -E_SHORT_WRITE if not
* all data could be written.
*
* \return Number of bytes written on success, negative error code else.
*/
int write_all(int fd, const char *buf, size_t len)
{
- int ret = write_nonblock(fd, buf, len);
+ int ret = xwrite(fd, buf, len);
if (ret < 0)
return ret;
* If \a rfds is not \p NULL and the (non-blocking) file descriptor \a fd is
* not set in \a rfds, this function returns early without doing anything.
* Otherwise The function tries to read up to \a sz bytes from \a fd. As for
- * write_nonblock(), EAGAIN is not considered an error condition. However, EOF
+ * xwrite(), EAGAIN is not considered an error condition. However, EOF
* is.
*
* \return Zero or a negative error code. If the underlying call to readv(2)
* have been read before the error occurred. In this case \a num_bytes is
* positive.
*
- * \sa \ref write_nonblock(), read(2), readv(2).
+ * \sa \ref xwrite(), read(2), readv(2).
*/
int readv_nonblock(int fd, struct iovec *iov, int iovcnt, fd_set *rfds,
size_t *num_bytes)
size_t *num_bytes);
int read_nonblock(int fd, void *buf, size_t sz, fd_set *rfds, size_t *num_bytes);
int read_pattern(int fd, const char *pattern, size_t bufsize, fd_set *rfds);
-int write_nonblock(int fd, const char *buf, size_t len);
+int xwrite(int fd, const char *buf, size_t len);
int for_each_file_in_dir(const char *dirname,
int (*func)(const char *, void *), void *private_data);
/**
gret = gcry_cipher_encrypt(scc->send->handle, tmp, size,
(unsigned char *)buf, size);
assert(gret == 0);
- ret = write_nonblock(scc->fd, (char *)tmp, size);
+ ret = xwrite(scc->fd, (char *)tmp, size);
free(tmp);
return ret;
}
if (gc->mode == GM_SLOPPY)
return len;
}
- ret = write_nonblock(gc->fd, buf, len);
+ ret = xwrite(gc->fd, buf, len);
if (ret < 0)
goto err;
if (ret > 0)
ret = queue_chunk_or_shutdown(sc, ss, buf, len);
goto out;
}
- ret = write_nonblock(sc->fd, buf, len);
+ ret = xwrite(sc->fd, buf, len);
if (ret < 0) {
shutdown_client(sc, ss);
goto out;
sz = btr_next_buffer(btrn, &buf);
if (sz == 0)
goto out;
- ret = write_nonblock(ici->fds[1], buf, sz);
+ ret = xwrite(ici->fds[1], buf, sz);
if (ret < 0)
goto rm_btrn;
btr_consume(btrn, ret);
ret = 0;
if (!FD_ISSET(powd->fd, &s->wfds))
goto out;
- ret = write_nonblock(powd->fd, data, frames * powd->bytes_per_frame);
+ ret = xwrite(powd->fd, data, frames * powd->bytes_per_frame);
if (ret < 0)
goto out;
btr_consume(btrn, ret);
int ret;
cq_get(qc, &buf, &len);
- ret = write_nonblock(fd, buf, len);
+ ret = xwrite(fd, buf, len);
if (ret < 0)
return ret;
cq_update(cq, ret);
sz = btr_next_buffer(btrn, &buf);
if (sz == 0)
break;
- ret = write_nonblock(STDOUT_FILENO, buf, sz);
+ ret = xwrite(STDOUT_FILENO, buf, sz);
if (ret <= 0)
break;
btr_consume(btrn, ret);
ret = udp_check_socket_state(sc);
if (ret < 0)
goto fail;
- ret = write_nonblock(sc->fd, buf, len);
+ ret = xwrite(sc->fd, buf, len);
if (ret == -ERRNO_TO_PARA_ERROR(ECONNREFUSED)) {
/*
* Happens if meanwhile an ICMP Destination / Port Unreachable