mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Use pread also in import and search
This commit is contained in:
parent
18cc80bd7e
commit
e69e8640ce
2 changed files with 2 additions and 16 deletions
|
|
@ -185,14 +185,7 @@ int state_import_fetch(struct snapraid_state* state, int rehash, struct snapraid
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (lseek(f, block->offset, SEEK_SET) != block->offset) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error seeking file '%s'. %s.\n", path, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ret = read(f, buffer, read_size);
|
||||
ret = pread(f, buffer, read_size, block->offset);
|
||||
if (ret < 0 || (unsigned)ret != read_size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error reading file '%s'. %s.\n", path, strerror(errno));
|
||||
|
|
|
|||
|
|
@ -89,14 +89,7 @@ int search_file_compare(const void* void_arg, const void* void_data)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (lseek(f, arg->offset, SEEK_SET) != arg->offset) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error seeking file '%s'. %s.\n", path, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ret = read(f, arg->buffer, arg->read_size);
|
||||
ret = pread(f, arg->buffer, arg->read_size, arg->offset);
|
||||
if (ret < 0 || (unsigned)ret != arg->read_size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error reading file '%s'. %s.\n", path, strerror(errno));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue