Merge "Preserve errno better in native_handle functions."