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",