aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-01-30 04:17:33 +0100
committerPieter Wuille <pieterw@google.com>2013-01-30 04:55:38 +0100
commit1eb578796c98f457546059b66eb98fd0efc8e690 (patch)
tree31f41b033a1c43799d1ed9b6eaab7ed705a908e4 /src/util.cpp
parent288fdc092aff9d7e0cea159196b2e96044a786c7 (diff)
downloadbitcoin-1eb578796c98f457546059b66eb98fd0efc8e690.tar.xz
Drop padding in blk* when finalizing file
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 6ea5e1d839..4ac66d4660 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1161,6 +1161,14 @@ int GetFilesize(FILE* file)
return nFilesize;
}
+bool TruncateFile(FILE *file, unsigned int length) {
+#if defined(WIN32)
+ return _chsize(_fileno(file), length) == 0;
+#else
+ return ftruncate(fileno(file), length) == 0;
+#endif
+}
+
// this function tries to make a particular range of a file allocated (corresponding to disk space)
// it is advisory, and the range specified in the arguments will never contain live data
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {