Anthony Liguori writes ("Re: [Qemu-devel] [PATCH] check return value from
read() and write() properly"):
> Ian Jackson wrote:
> > The system calls read and write may return less than the whole amount
> > requested for a number of reasons. So the idioms
> >if (
Ian Jackson wrote:
The system calls read and write may return less than the whole amount
requested for a number of reasons. So the idioms
if (read(fd, &object, sizeof(object)) != sizeof(object)) goto fail;
and even worse
if (read(fd, &object, sizeof(object)) < 0) goto fail;
are wrong. Add
The system calls read and write may return less than the whole amount
requested for a number of reasons. So the idioms
if (read(fd, &object, sizeof(object)) != sizeof(object)) goto fail;
and even worse
if (read(fd, &object, sizeof(object)) < 0) goto fail;
are wrong. Additionally, read and w