> On Jan 14, 2021, at 11:27 AM, Stefan Hajnoczi <stefa...@redhat.com> wrote: > > On Thu, Jan 14, 2021 at 10:40:03AM -0500, Jagannathan Raman 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 = qio_channel_readv_all_eof(ioc, iov, niov, errp); >> + int ret = qio_channel_readv_full_all_eof(ioc, iov, niov, fds, nfds, >> errp); >> >> if (ret == 0) { >> - ret = -1; >> error_setg(errp, >> "Unexpected end-of-file before all bytes were read"); > > qio_channel_readv_full_all_eof() can read file descriptors but no data > and return 0. > > Here that case is converted into an error and the file descriptors > aren't closed, freed, and fds/nfds isn't cleared. That’s a valid point. I’m wondering if the fix for this case should be in qio_channel_readv_full_all_eof(), instead of here. qio_channel_readv_full_all_eof() should probably return error (-1) if the amount of data read does not match iov_size(). If the caller is only expecting to read fds, and not any data, it would indicate that by setting iov to NULL and/or setting niov=0. If the caller is setting these parameters, it means it is expecting data.Does that sound good? Thanks!
- [PATCH v19 03/20] memory: alloc RAM from file at offs... Jagannathan Raman
- [PATCH v19 09/20] multi-process: define MPQemuMsg for... Jagannathan Raman
- [PATCH v19 14/20] multi-process: add proxy communicat... Jagannathan Raman
- [PATCH v19 07/20] io: add qio_channel_writev_full_all... Jagannathan Raman
- [PATCH v19 01/20] multi-process: add the concept desc... Jagannathan Raman
- [PATCH v19 05/20] multi-process: setup PCI host bridg... Jagannathan Raman
- [PATCH v19 04/20] multi-process: Add config option fo... Jagannathan Raman
- [PATCH v19 13/20] multi-process: introduce proxy obje... Jagannathan Raman
- [PATCH v19 08/20] io: add qio_channel_readv_full_all_... Jagannathan Raman
- Re: [PATCH v19 08/20] io: add qio_channel_readv_... Stefan Hajnoczi
- Re: [PATCH v19 08/20] io: add qio_channel_re... Jag Raman
- Re: [PATCH v19 08/20] io: add qio_channe... Daniel P . Berrangé
- Re: [PATCH v19 08/20] io: add qio_ch... Jag Raman
- Re: [PATCH v19 08/20] io: add q... Stefan Hajnoczi
- Re: [PATCH v19 08/20] io: a... Jag Raman
- Re: [PATCH v19 08/20] io: a... Jag Raman
- Re: [PATCH v19 08/20] io: a... Stefan Hajnoczi
- [PATCH v19 17/20] multi-process: Synchronize remote m... Jagannathan Raman
- [PATCH v19 10/20] multi-process: Initialize message h... Jagannathan Raman
- [PATCH v19 18/20] multi-process: create IOHUB object ... Jagannathan Raman
- [PATCH v19 06/20] multi-process: setup a machine obje... Jagannathan Raman