Re: [Qemu-devel] [PATCH] check return value from read() and write() properly

2008-02-07 Thread Ian Jackson
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 (

Re: [Qemu-devel] [PATCH] check return value from read() and write() properly

2008-02-06 Thread Anthony Liguori
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

[Qemu-devel] [PATCH] check return value from read() and write() properly

2008-01-25 Thread Ian Jackson
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