libnative/file_unix: fix offset of pwrite.

Also introduce new hellper functions check_error() and
check_error_unit().

Signed-off-by: NODA, Kai <nodakai@gmail.com>