Commit ab00c592 authored by Ramon Nou's avatar Ramon Nou
Browse files

Fix fallocate error handling in

posix_file::file::fallocate
parent b470a8e8
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ class Cargo(CMakePackage):
    version("0.3.1", sha256="613485354e24c4b97cb6d045657569f94dc1d9bbb391b5a166f8d18b3595428b")
    version("0.3.2", sha256="ceb6bcb738a35fb41f40b7b1cdd8a806d99995a227980e8ced61dd90418e5960")
    version("0.3.3", sha256="1c4ab215e41905cc359894fa1df9006be16730ddc37c5b1369a9ea759bcb61cd")
    version("0.3.4", branch="rnou/fallocate")
    # build variants
    variant('build_type',
            default='Release',
+9 −9
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ public:
    fallocate(int mode, offset offset, std::size_t len) const {

        if(!m_handle) {
            throw io_error("posix_file::file::fallocate", EBADF);
            throw io_error("posix_file::file::fallocate (handle)", EBADF);
        }

        int ret = ::fallocate(m_handle.native(), mode, offset,
@@ -190,15 +190,15 @@ public:

        if(ret == -1) {
            // Try an alternative to fallocate for beegfs
            if(errno == EOPNOTSUPP) {

            ret = ::posix_fallocate(m_handle.native(), offset,
                                    static_cast<off_t>(len));
            if(ret == -1) {
                throw io_error("posix_file::file::posix_fallocate", errno);
                } else return;
            }
            throw io_error("posix_file::file::fallocate", errno);
            } else
                return;

            throw io_error("posix_file::file::fallocate", errno);
        }
    }