Even better emulate POSIX file functions (reduced)

This is reduced version of #5694.
Only obvious fixes.
Some VFSes (POSIX version of SMBFile for example) always return error if null is supplied as buffer pointer.