From 59c7c7380c963abf021a74e619a16f303dada817 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 8 Oct 2011 10:32:17 +0200 Subject: [PATCH] Prints more error information in case of some errors. --- handle.c | 6 +++--- parity.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/handle.c b/handle.c index 9a69fb12..47fdb9e8 100644 --- a/handle.c +++ b/handle.c @@ -240,18 +240,18 @@ int handle_read(struct snapraid_handle* handle, struct snapraid_block* block, un read_ret = pread(handle->f, block_buffer, read_size, offset); #else if (lseek(handle->f, offset, SEEK_SET) != offset) { - fprintf(stderr, "Error seeking file '%s'. %s.\n", handle->path, strerror(errno)); + fprintf(stderr, "Error seeking file '%s' at offset %"PRIu64". %s.\n", handle->path, offset, strerror(errno)); return -1; } read_ret = read(handle->f, block_buffer, read_size); #endif if (read_ret < 0) { - fprintf(stderr, "Error reading file '%s'. %s.\n", handle->path, strerror(errno)); + fprintf(stderr, "Error reading file '%s' at offset %"PRIu64". %s.\n", handle->path, offset, strerror(errno)); return -1; } if (read_ret != (ssize_t)read_size) { /* signed conversion is safe because block_size is always small */ - fprintf(stderr, "File '%s' is smaller than expected.\n", handle->path); + fprintf(stderr, "File '%s' is smaller than expected. Read %d bytes instead of %d at offset %"PRIu64".\n", handle->path, (int)read_ret, read_size, offset); return -1; } diff --git a/parity.c b/parity.c index d7119157..2b905634 100644 --- a/parity.c +++ b/parity.c @@ -221,18 +221,18 @@ int parity_read(const char* path, int f, block_off_t pos, unsigned char* block_b read_ret = pread(f, block_buffer, block_size, offset); #else if (lseek(f, offset, SEEK_SET) != offset) { - fprintf(stderr, "Error seeking file '%s'. %s.\n", path, strerror(errno)); + fprintf(stderr, "Error seeking file '%s' at offset %"PRIu64". %s.\n", path, offset, strerror(errno)); return -1; } read_ret = read(f, block_buffer, block_size); #endif if (read_ret < 0) { - fprintf(stderr, "Error reading file '%s'. %s.\n", path, strerror(errno)); + fprintf(stderr, "Error reading file '%s' at offset %"PRIu64". %s.\n", path, offset, strerror(errno)); return -1; } if (read_ret != (ssize_t)block_size) { /* signed conversion is safe because block_size is always small */ - fprintf(stderr, "File '%s' is smaller than expected.\n", path); + fprintf(stderr, "File '%s' is smaller than expected. Read %d bytes instead of %d at offset %"PRIu64".\n", path, (int)read_ret, block_size, offset); return -1; }