aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/fhandler/base.cc9
-rw-r--r--winsup/cygwin/release/3.4.103
2 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc
index d859870..b933662 100644
--- a/winsup/cygwin/fhandler/base.cc
+++ b/winsup/cygwin/fhandler/base.cc
@@ -776,6 +776,15 @@ fhandler_base::open (int flags, mode_t mode)
NtClose (fh);
goto done;
}
+ /* Drop sparseness */
+ if (pc.file_attributes () & FILE_ATTRIBUTE_SPARSE_FILE)
+ {
+ FILE_SET_SPARSE_BUFFER fssb = { SetSparse: FALSE };
+ status = NtFsControlFile (fh, NULL, NULL, NULL, &io,
+ FSCTL_SET_SPARSE, &fssb, sizeof fssb, NULL, 0);
+ if (NT_SUCCESS (status))
+ pc.file_attributes (pc.file_attributes () & ~FILE_ATTRIBUTE_SPARSE_FILE);
+ }
}
set_handle (fh);
diff --git a/winsup/cygwin/release/3.4.10 b/winsup/cygwin/release/3.4.10
index 02f6885..632ffcd 100644
--- a/winsup/cygwin/release/3.4.10
+++ b/winsup/cygwin/release/3.4.10
@@ -21,3 +21,6 @@ Bug Fixes
- Fix posix_fallocate(3) return value in case of being called on
other than regular files.
+
+- Reset sparseness in case open(2) has been called with O_CREAT|O_TRUNC on
+ sparse files.