Skip to content

Commit c62f1f8

Browse files
bors[bot]farnoy
andcommitted
Merge #914
914: Make preadv take immutable slice of IoVecs r=asomers a=farnoy fixes #913 I filled in the CHANGELOG, but I see that it usually links to PRs and not issues, do you want me to change it or remove and leave for you to describe? This change seems to be strictly backwards-compatible, I didn't have to change the test for it to work. Co-authored-by: Jakub Okoński <[email protected]>
2 parents 8a9b86e + db4ea2b commit c62f1f8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1010
### Changed
1111

1212
### Fixed
13+
- Made `preadv` take immutable slice of IoVec.
14+
([#914](https://github.com/nix-rust/nix/pull/914))
1315

1416
### Removed
1517

src/sys/uio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn pwritev(fd: RawFd, iov: &[IoVec<&[u8]>],
5151
target_os = "linux",
5252
target_os = "netbsd",
5353
target_os = "openbsd"))]
54-
pub fn preadv(fd: RawFd, iov: &mut [IoVec<&mut [u8]>],
54+
pub fn preadv(fd: RawFd, iov: &[IoVec<&mut [u8]>],
5555
offset: off_t) -> Result<usize> {
5656
let res = unsafe {
5757
libc::preadv(fd, iov.as_ptr() as *const libc::iovec, iov.len() as c_int, offset)

test/sys/test_uio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ fn test_preadv() {
182182

183183
{
184184
// Borrow the buffers into IoVecs and preadv into them
185-
let mut iovecs: Vec<_> = buffers.iter_mut().map(
185+
let iovecs: Vec<_> = buffers.iter_mut().map(
186186
|buf| IoVec::from_mut_slice(&mut buf[..])).collect();
187-
assert_eq!(Ok(100), preadv(file.as_raw_fd(), &mut iovecs, 100));
187+
assert_eq!(Ok(100), preadv(file.as_raw_fd(), &iovecs, 100));
188188
}
189189

190190
let all = buffers.concat();

0 commit comments

Comments
 (0)