There's no point trying to read 0 bytes, so let's just not
do this and switch to a while loop like in Write().
Gbp-Dch: ignore
gracefully. */
bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
{
- ssize_t Res;
+ ssize_t Res = 1;
errno = 0;
if (Actual != 0)
*Actual = 0;
*((char *)To) = '\0';
- do
+ while (Res > 0 && Size > 0)
{
if (false)
/* dummy so that the rest can be 'else if's */;
if (Actual != 0)
*Actual += Res;
}
- while (Res > 0 && Size > 0);
if (Size == 0)
return true;