From 903ced679f1f625406a01283e0c40d3be72d67f4 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sat, 14 Nov 2015 17:03:26 +0100 Subject: [PATCH] Disable the file zero check in Windows --- HISTORY | 6 ++++++ TODO | 3 --- cmdline/scan.c | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 07fbb93b..c23c9cfe 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,12 @@ SnapRAID HISTORY ================ +9.1 2015/12 +=========== + * In Winwdows disables the file zero check requring the --force-zero + option. This check is intended for possible case using ext3/4 in Linux, + and there is no evidence that in Windows it's possible at all. + 9.0 2015/11 =========== * Fixes an invalid assumption that could happen when using the diff --git a/TODO b/TODO index c40243a3..6b216ece 100644 --- a/TODO +++ b/TODO @@ -12,9 +12,6 @@ In fact, it makes sense as it's a good way to control the cache on the file, so, despite the name, that usage could be common for not temporary files. https://sourceforge.net/p/snapraid/discussion/1677233/thread/57d40108/ -* Disable the "force-zero" check on Windows. No reason to have it. -https://sourceforge.net/p/snapraid/discussion/1677233/thread/88144165/ - * Restore ownership and permissions, at least in Unix. * Restore directory timestamps. diff --git a/cmdline/scan.c b/cmdline/scan.c index 5031ecd6..b335a2fa 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -862,8 +862,10 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, /* because this is slow operation */ scan_file_refresh(scan, sub, st, &physical); +#ifndef _WIN32 /* do a safety check to ensure that the common ext4 case of zeroing */ /* the size of a file after a crash doesn't propagate to the backup */ + /* this check is specific for Linux, so we disable it on Windows */ if (is_original_file_size_different_than_zero && st->st_size == 0) { if (!state->opt.force_zero) { /* LCOV_EXCL_START */ @@ -877,6 +879,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, /* LCOV_EXCL_STOP */ } } +#endif /* insert it */ file = file_alloc(state->block_size, sub, st->st_size, st->st_mtime, STAT_NSEC(st), st->st_ino, physical);