On Thu, Dec 17, 2020 at 09:40:39PM -0800, [email protected] wrote: > +int qio_channel_readv_full_all(QIOChannel *ioc, > + const struct iovec *iov, > + size_t niov, > + int **fds, size_t *nfds, > + Error **errp) > { > int ret = -1; > struct iovec *local_iov = g_new(struct iovec, niov); > struct iovec *local_iov_head = local_iov; > unsigned int nlocal_iov = niov; > + int **local_fds = fds; > + size_t *local_nfds = nfds; > bool partial = false; > > nlocal_iov = iov_copy(local_iov, nlocal_iov, > @@ -104,7 +140,8 @@ int qio_channel_readv_all_eof(QIOChannel *ioc, > > while (nlocal_iov > 0) { > ssize_t len; > - len = qio_channel_readv(ioc, local_iov, nlocal_iov, errp); > + len = qio_channel_readv_full(ioc, local_iov, nlocal_iov, local_fds, > + local_nfds, errp); > if (len == QIO_CHANNEL_ERR_BLOCK) { > if (qemu_in_coroutine()) { > qio_channel_yield(ioc, G_IO_IN); > @@ -112,20 +149,21 @@ int qio_channel_readv_all_eof(QIOChannel *ioc, > qio_channel_wait(ioc, G_IO_IN); > } > continue; > - } else if (len < 0) { > - goto cleanup; > - } else if (len == 0) { > - if (partial) { > - error_setg(errp, > - "Unexpected end-of-file before all bytes were > read"); > + } > + if (len <= 0) { > + if (partial && (len == 0)) { > + ret = -ECANCELED;
Do callers expect fds to be non-NULL when an error is returned? This could lead to file descriptor and memory leaks.
signature.asc
Description: PGP signature
