All pastes #885247 Raw Edit

Anonymous

public text v1 · immutable
#885247 ·published 2008-01-30 20:49 UTC
rendered paste body
Index: src/data/socket_file.cc
===================================================================
--- src/data/socket_file.cc	(revision 1037)
+++ src/data/socket_file.cc	(working copy)
@@ -98,9 +98,9 @@
 #endif
 
 bool
-SocketFile::reserve(RESERVE_PARAM uint64_t offset, RESERVE_PARAM uint64_t length) {
+SocketFile::reserve(RESERVE_PARAM uint64_t offset, RESERVE_PARAM uint64_t length) const {
 #ifdef USE_XFS
-  struct xfs_flock64 flock;
+  struct ::xfs_flock64 flock;
 
   flock.l_whence = SEEK_SET;
   flock.l_start = offset;
@@ -134,6 +134,9 @@
   if (!is_open())
     throw internal_error("SocketFile::set_size() called on a closed file");
 
+  if (!reserve(0, size))
+    throw internal_error("SocketFile::reserve() failed");
+
   if (ftruncate(m_fd, size) == 0)
     return true;
 
Index: src/data/socket_file.h
===================================================================
--- src/data/socket_file.h	(revision 1037)
+++ src/data/socket_file.h	(working copy)
@@ -67,7 +67,7 @@
   
   // Reserve the space on disk if a system call is defined. 'length'
   // of zero indicates to the end of the file.
-  bool                reserve(uint64_t offset = 0, uint64_t length = 0);
+  bool                reserve(uint64_t offset = 0, uint64_t length = 0) const;
 
   bool                is_open() const                                   { return m_fd != invalid_fd; }
 
Index: configure.ac
===================================================================
--- configure.ac	(revision 1037)
+++ configure.ac	(working copy)
@@ -43,7 +43,7 @@
 TORRENT_ENABLE_ARCH
 TORRENT_WITH_SYSROOT
 
-dnl TORRENT_WITH_XFS
+TORRENT_WITH_XFS
 TORRENT_WITH_KQUEUE
 TORRENT_WITHOUT_EPOLL
 TORRENT_WITH_POSIX_FALLOCATE