Most recent kernel where this bug did not occur: Distribution: Fedora Core 4 Hardware Environment: x86, 1G memory, IDE HDD Software Environment: kernel 2.6.17-1.2142_FC4, glibc-2.3.5-10 Problem Description: When reading from an inotify device with an insufficient sized buffer, read(2) will return 0 with no errno set. This is because of an logically incorrect action from the user program thus should return an more logical value. My suggestion is return -EINVAL as for bind(2). Steps to reproduce: Test program will be provided.
Created attachment 8770 [details] Test program to reproduce the described situation. Sample output: $ ./itest . 32 bytes left in queue. read() returns 0 with msg Success
Created attachment 8771 [details] Sample patch
hey, I don't think the patch is correct. If the user passes in a buffer large enough to hold at least one event, but there are more in the queue that won't fit, they'll still get -EINVAL.
Created attachment 10253 [details] inotify fix How about this patch, then?