summaryrefslogtreecommitdiffstats
path: root/src/hdaccess.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-06-28 08:42:30 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2012-06-28 08:42:30 +0200
commit682f15d9982e73c50b2aea5fbc580ac8619650d0 (patch)
tree24978dda67f79d414d2d6fa87d5fb5b1c51d5a1a /src/hdaccess.c
parent42acc4c0e8fc117b1783dbf194139b844543f7fe (diff)
when HDCLONING is defined, remove open() O_EXCL parameter and save partial read data
Diffstat (limited to 'src/hdaccess.c')
-rw-r--r--src/hdaccess.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/hdaccess.c b/src/hdaccess.c
index 0e36109..0f84267 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);
}