From 682f15d9982e73c50b2aea5fbc580ac8619650d0 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Thu, 28 Jun 2012 08:42:30 +0200 Subject: [PATCH] when HDCLONING is defined, remove open() O_EXCL parameter and save partial read data --- src/hdaccess.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hdaccess.c b/src/hdaccess.c index 0e361097..0f84267a 100644 --- a/src/hdaccess.c +++ b/src/hdaccess.c @@ -1215,13 +1215,13 @@ static int file_pread_aux(disk_t *disk, void *buf, const unsigned int count, con memset((char*)buf+ret,0,count-ret); } #ifdef HDCLONE - else + if(ret>0) { int handle_clone=((struct info_file_struct *)disk->data)->handle_clone; if(handle_clone>0) { - pwrite(handle_clone, buf, count, offset); - fdatasync(handle_clone); + pwrite(handle_clone, buf, ret, offset); +// fdatasync(handle_clone); } } #endif @@ -1572,9 +1572,9 @@ disk_t *file_test_availability(const char *device, const int verbose, int testdi char *new_file=(char *)MALLOC(strlen(device)+5); sprintf(new_file, "%s.dd", device); #ifdef O_LARGEFILE - data->handle_clone=open(new_file, O_CREAT|O_EXCL|O_LARGEFILE|O_WRONLY,00600); + data->handle_clone=open(new_file, O_CREAT|O_LARGEFILE|O_RDWR,00600); #else - data->handle_clone=open(new_file, O_CREAT|O_EXCL|O_WRONLY,00600); + data->handle_clone=open(new_file, O_CREAT|O_RDWR,00600); #endif free(new_file); }