]> wimlib.net Git - wimlib/commitdiff
write.c: add error messages around all read and write failures
authorEric Biggers <ebiggers3@gmail.com>
Sat, 6 Feb 2016 18:31:39 +0000 (12:31 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 9 Feb 2016 01:51:10 +0000 (19:51 -0600)
src/write.c

index cc569395d19c12f3f499b5a68f8523f33e5055bd..dff5118c86d8e6e992589a51e6ed6560b2e6ae6a 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /*
  */
 
 /*
- * Copyright (C) 2012, 2013, 2014, 2015 Eric Biggers
+ * Copyright (C) 2012-2016 Eric Biggers
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -288,7 +288,7 @@ write_pwm_blob_header(const struct blob_descriptor *blob,
        blob_hdr.flags = cpu_to_le32(reshdr_flags);
        ret = full_write(out_fd, &blob_hdr, sizeof(blob_hdr));
        if (ret)
        blob_hdr.flags = cpu_to_le32(reshdr_flags);
        ret = full_write(out_fd, &blob_hdr, sizeof(blob_hdr));
        if (ret)
-               ERROR_WITH_ERRNO("Write error");
+               ERROR_WITH_ERRNO("Error writing blob header to WIM file");
        return ret;
 }
 
        return ret;
 }
 
@@ -461,8 +461,11 @@ begin_chunk_table(struct write_blobs_ctx *ctx, u64 res_expected_size)
                        reserve_size += sizeof(struct alt_chunk_table_header_disk);
                memset(ctx->chunk_csizes, 0, reserve_size);
                ret = full_write(ctx->out_fd, ctx->chunk_csizes, reserve_size);
                        reserve_size += sizeof(struct alt_chunk_table_header_disk);
                memset(ctx->chunk_csizes, 0, reserve_size);
                ret = full_write(ctx->out_fd, ctx->chunk_csizes, reserve_size);
-               if (ret)
+               if (ret) {
+                       ERROR_WITH_ERRNO("Error reserving space for chunk "
+                                        "table in WIM file");
                        return ret;
                        return ret;
+               }
        }
        return 0;
 }
        }
        return 0;
 }
@@ -588,7 +591,7 @@ end_chunk_table(struct write_blobs_ctx *ctx, u64 res_actual_size,
        return 0;
 
 write_error:
        return 0;
 
 write_error:
-       ERROR_WITH_ERRNO("Write error");
+       ERROR_WITH_ERRNO("Error writing chunk table to WIM file");
        return ret;
 }
 
        return ret;
 }
 
@@ -983,7 +986,7 @@ write_chunk(struct write_blobs_ctx *ctx, const void *cchunk,
                                       completed_blob_count, false);
 
 write_error:
                                       completed_blob_count, false);
 
 write_error:
-       ERROR_WITH_ERRNO("Write error");
+       ERROR_WITH_ERRNO("Error writing chunk data to WIM file");
        return ret;
 }
 
        return ret;
 }
 
@@ -1240,12 +1243,18 @@ write_raw_copy_resource(struct wim_resource_descriptor *in_rdesc,
 
                        ret = full_pread(in_fd, buf, bytes_to_read,
                                         cur_read_offset);
 
                        ret = full_pread(in_fd, buf, bytes_to_read,
                                         cur_read_offset);
-                       if (ret)
+                       if (ret) {
+                               ERROR_WITH_ERRNO("Error reading raw data "
+                                                "from WIM file");
                                return ret;
                                return ret;
+                       }
 
                        ret = full_write(out_fd, buf, bytes_to_read);
 
                        ret = full_write(out_fd, buf, bytes_to_read);
-                       if (ret)
+                       if (ret) {
+                               ERROR_WITH_ERRNO("Error writing raw data "
+                                                "to WIM file");
                                return ret;
                                return ret;
+                       }
 
                        cur_read_offset += bytes_to_read;
 
 
                        cur_read_offset += bytes_to_read;