mirror of
https://git.freebsd.org/ports.git
synced 2025-05-01 02:56:39 -04:00
Safecopy is a data recovery tool which tries to extract as much data as possible from a problematic (i.e. damaged sectors) source - like floppy drives, hard disk partitions, CDs, tape devices etc, ... , where other tools like dd would fail due to I/O errors. Safecopy includes a low level IO layer to read CDROM disks in raw mode, and issue device resets and other helpful low level operations on a number of other device classes. The project also includes a device simulator which can be used to simulate bad media for testing and benchmarking safecopy as well as other data rescue tools. WWW: http://safecopy.sourceforge.net/ PR: 216892 Submitted by: anastasios@mageirias.com Approved by: mat (mentor) Differential Revision: https://reviews.freebsd.org/D9479
29 lines
1.7 KiB
C
29 lines
1.7 KiB
C
--- src/safecopy.c.orig 2017-02-07 19:49:05 UTC
|
|
+++ src/safecopy.c
|
|
@@ -900,7 +900,7 @@ int main(int argc, char ** argv) {
|
|
fprintf(stdout, "File size: %llu\n", (long long) statusvars->filesize );
|
|
} else {
|
|
fprintf(stderr, "Filesize not reported by stat(), trying seek().\n");
|
|
- statusvars->source = open(configvars->sourcefile, O_RDONLY | O_RSYNC);
|
|
+ statusvars->source = open(configvars->sourcefile, O_RDONLY | O_SYNC);
|
|
if (statusvars->source) {
|
|
statusvars->filesize = lseek(statusvars->source, 0, SEEK_END);
|
|
close(statusvars->source);
|
|
@@ -1691,7 +1691,7 @@ int main(int argc, char ** argv) {
|
|
for ( statusvars->cseeks = 0; statusvars->cseeks < statusvars->seeks ; statusvars->cseeks ++) {
|
|
debug(DEBUG_SEEK, "debug: forced head realignment\n");
|
|
// note. must use O_RSYNC since with O_DIRECT / raw devices, lseek to end of file might not work
|
|
- statusvars->source = open(configvars->sourcefile, O_RDONLY | O_NONBLOCK | O_RSYNC );
|
|
+ statusvars->source = open(configvars->sourcefile, O_RDONLY | O_NONBLOCK | O_SYNC );
|
|
if (statusvars->source) {
|
|
lseek(statusvars->source, 0, SEEK_SET);
|
|
select_for_reading(statusvars->source, configvars, statusvars);
|
|
@@ -1699,7 +1699,7 @@ int main(int argc, char ** argv) {
|
|
read(statusvars->source, statusvars->databuffer , statusvars->blocksize );
|
|
close(statusvars->source);
|
|
}
|
|
- statusvars->source = open(configvars->sourcefile, O_RDONLY | O_NONBLOCK | O_RSYNC );
|
|
+ statusvars->source = open(configvars->sourcefile, O_RDONLY | O_NONBLOCK | O_SYNC );
|
|
if (statusvars->source) {
|
|
lseek(statusvars->source,- statusvars->blocksize , SEEK_END);
|
|
select_for_reading(statusvars->source, configvars, statusvars);
|