mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Some error messages changes.
This commit is contained in:
parent
23a26390ce
commit
1ed3d59c02
2 changed files with 11 additions and 7 deletions
6
handle.c
6
handle.c
|
|
@ -250,7 +250,7 @@ int handle_read(struct snapraid_handle* handle, struct snapraid_block* block, un
|
|||
fprintf(stderr, "Error reading file '%s'. %s.\n", handle->path, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (read_ret != (ssize_t)read_size) {
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -260,8 +260,8 @@ int handle_read(struct snapraid_handle* handle, struct snapraid_block* block, un
|
|||
memset(block_buffer + read_size, 0, block_size - read_size);
|
||||
}
|
||||
|
||||
/* Here isn't needed to call posix_fadvise(..., POSIX_FADV_DONTNEED) because */
|
||||
/* we already advised sequential access with POSIX_FADV_SEQUENTIAL. */
|
||||
/* Here isn't needed to call posix_fadvise(..., POSIX_FADV_DONTNEED) */
|
||||
/* because we already advised sequential access with POSIX_FADV_SEQUENTIAL. */
|
||||
/* In Linux 2.6.33 it's enough to ensure that data is not kept in the cache. */
|
||||
/* Better to do nothing and save a syscall for each block. */
|
||||
|
||||
|
|
|
|||
12
parity.c
12
parity.c
|
|
@ -226,14 +226,18 @@ int parity_read(const char* path, int f, block_off_t pos, unsigned char* block_b
|
|||
}
|
||||
|
||||
read_ret = read(f, block_buffer, block_size);
|
||||
#endif
|
||||
if (read_ret != (ssize_t)block_size) { /* conversion is safe because block_size is always small */
|
||||
#endif
|
||||
if (read_ret < 0) {
|
||||
fprintf(stderr, "Error reading file '%s'. %s.\n", path, 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);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Here isn't needed to call posix_fadvise(..., POSIX_FADV_DONTNEED) because */
|
||||
/* we already advised sequential access with POSIX_FADV_SEQUENTIAL. */
|
||||
/* Here isn't needed to call posix_fadvise(..., POSIX_FADV_DONTNEED) */
|
||||
/* because we already advised sequential access with POSIX_FADV_SEQUENTIAL. */
|
||||
/* In Linux 2.6.33 it's enough to ensure that data is not kept in the cache. */
|
||||
/* Better to do nothing and save a syscall for each block. */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue