| 109 | //------------------------------------------------------------------------- |
| 110 | |
| 111 | int |
| 112 | RecSnapFileWrite(RecHandle h_file, char *buf, int size, int *bytes_written) |
| 113 | { |
| 114 | // First write the version byes for snap file |
| 115 | std::array<char, VERSION_HDR_SIZE> VERSION_HDR{ |
| 116 | {'V', PACKAGE_VERSION[0], PACKAGE_VERSION[2], PACKAGE_VERSION[4], '\0'} |
| 117 | }; |
| 118 | if (::write(h_file, VERSION_HDR.data(), VERSION_HDR_SIZE) < 0) { |
| 119 | return REC_ERR_FAIL; |
| 120 | } |
| 121 | |
| 122 | if ((*bytes_written = ::pwrite(h_file, buf, size, VERSION_HDR_SIZE)) < 0) { |
| 123 | *bytes_written = 0; |
| 124 | return REC_ERR_FAIL; |
| 125 | } |
| 126 | return REC_ERR_OKAY; |
| 127 | } |
| 128 | |
| 129 | //------------------------------------------------------------------------- |
| 130 | // RecFileWrite |
no test coverage detected