Merge FileRead/FileReadMax into single function

This change simplifies error reporting and avoids unreliable checking
of stat(2) to preallocate buffers. (Closes: Redmine #3658).