Hi,
I have got the kvm.c from QNX CVS. There seems to be a possible bug in
kvm_read() function.
On my machine kvm_read() opens ‘/proc/98317/as’ file and seeks to the given
offset. After that, the following code is executed.
while (len)
{
if ((r = read(fd, data, len)) == -1)
{
fd = -1;
return -1;
}
len -= r;
data += r;
}
On my machine (QNX RTP 6) due to some reasons, the read() function reads
zero bytes (r=0)and does not return -1 (no error). Due to this, the above
loop becomes an infinite loop as long as read() keeps reading zero bytes.
Isn’t it a bug that the possibility of zero bytes being read is not
considered?
I would also like to know why read() is reading zero bytes on my machine? On
some other machines, the exact same code works perfectly. Any ideas?
Thanks in advance…
-Farooque