X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fsplit.c;h=25ca3cdb0ddc3747fd60627ab321342e0c57f838;hp=05a7beebd9585b2d4141b26b4e284c881103feea;hb=58daaca96dc8b23e345342e844c58b1972e5fedf;hpb=f3ab01445d6184f7c5ffd0251667de7ef7437f9a diff --git a/src/split.c b/src/split.c index 05a7beeb..25ca3cdb 100644 --- a/src/split.c +++ b/src/split.c @@ -28,7 +28,7 @@ #endif #include "wimlib.h" -#include "wimlib/buffer_io.h" +#include "wimlib/endianness.h" #include "wimlib/error.h" #include "wimlib/file_io.h" #include "wimlib/lookup_table.h" @@ -143,10 +143,6 @@ wimlib_split(WIMStruct *w, const tchar *swm_name, write_flags &= WIMLIB_WRITE_MASK_PUBLIC; - ret = wim_checksum_unhashed_streams(w); - if (ret) - return ret; - swm_name_len = tstrlen(swm_name); tchar swm_base_name[swm_name_len + 20]; @@ -224,8 +220,9 @@ wimlib_split(WIMStruct *w, const tchar *swm_name, for (int i = 1; i <= total_parts; i++) { const tchar *part_name; int part_fd; - u8 part_data_buf[4]; + le16 part_data[2]; size_t bytes_written; + int ret2; if (i == 1) { part_name = swm_name; @@ -241,16 +238,14 @@ wimlib_split(WIMStruct *w, const tchar *swm_name, ret = WIMLIB_ERR_OPEN; goto out; } - put_u16(&part_data_buf[0], i); - put_u16(&part_data_buf[2], total_parts); - bytes_written = full_pwrite(part_fd, part_data_buf, - sizeof(part_data_buf), 40); - ret = close(part_fd); - if (bytes_written != sizeof(part_data_buf) || ret != 0) { + ret = write_header_part_data(i, total_parts, part_fd); + ret2 = close(part_fd); + if (ret == 0 && ret2 != 0) + ret = WIMLIB_ERR_WRITE; + if (ret) { ERROR_WITH_ERRNO("Error updating header of `%"TS"'", part_name); - ret = WIMLIB_ERR_WRITE; goto out; } }