Subject: | sysread wrapper behaviour |
sub read
{
...
elsif ( $! != EAGAIN )
{
return undef;
}
It's looks like it should not return undef in case when it read data at least once in loop.
i.e.
- return undef
+ return $offset ? $offset : undef
I have similar code (but for blocking sockets) with tests which cover that case
https://github.com/vsespb/mt-aws-glacier/blob/7548bc0985d85dc524fdfaeeeeb7813a7facaee6/lib/App/MtAws/Utils.pm#L209
https://github.com/vsespb/mt-aws-glacier/blob/7548bc0985d85dc524fdfaeeeeb7813a7facaee6/t/integration/sysread_syswrite_full.t
https://github.com/vsespb/mt-aws-glacier/blob/7548bc0985d85dc524fdfaeeeeb7813a7facaee6/t/unit/sysread_syswrite_unit.t
p.s.
same for syswrite