From 9064823bc4478bc8a1e777b42339f22998dee304 Mon Sep 17 00:00:00 2001 From: Diana <5275194+DianaNites@users.noreply.github.com> Date: Sat, 28 Mar 2020 14:18:42 -0400 Subject: [PATCH] Fix fallocate return type Untested, done on github. Fixes #1200 --- CHANGELOG.md | 1 + src/fcntl.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d31a09aa1c..dc64b24c94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Derived `Ord`, `PartialOrd` for `unistd::Pid` (#[1189](https://github.com/nix-rust/nix/pull/1189)) ### Changed +- Changed `fallocate` return type from `c_int` to `()` (#[1201](https://github.com/nix-rust/nix/pull/1201)) ### Fixed ### Removed diff --git a/src/fcntl.rs b/src/fcntl.rs index 1d66eb75d4..773d79913e 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -468,9 +468,9 @@ libc_bitflags!( /// Allows the caller to directly manipulate the allocated disk space for the /// file referred to by fd. #[cfg(any(target_os = "linux"))] -pub fn fallocate(fd: RawFd, mode: FallocateFlags, offset: libc::off_t, len: libc::off_t) -> Result { +pub fn fallocate(fd: RawFd, mode: FallocateFlags, offset: libc::off_t, len: libc::off_t) -> Result<()> { let res = unsafe { libc::fallocate(fd, mode.bits(), offset, len) }; - Errno::result(res) + Errno::result(res).map(drop) } #[cfg(any(target_os = "linux",