Skip to content

Commit 75370ba

Browse files
better wording
1 parent dcf57ba commit 75370ba

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

test/test_fcntl.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,12 @@ mod test_posix_fallocate {
259259
assert_eq!(&data as &[u8], &[0u8; LEN] as &[u8]);
260260
}
261261
Err(nix::Error::Sys(Errno::EINVAL)) => {
262-
// `posix_fallocate` returned EINVAL.
263-
// According to POSIX.1-2008, its implementation shall
264-
// return `EINVAL` if `len` is 0, `offset` is negative or
265-
// the filesystem does not support this operation.
266-
// According to POSIX.1-2001, its implementation shall
267-
// return `EINVAL` if `len` is negative, `offset` is
268-
// negative or the filesystem does not support this
269-
// operation; and may return `EINVAL` if `len` is 0.
270-
// However, this test is using `offset=0` and non-zero
271-
// `len`.
272-
// Suppose that the host platform is POSIX-compliant,
273-
// then this can only be due to an underlying filesystem on
274-
// `/tmp` that does not support `posix_fallocate`.
275-
// This test is passing by giving it the benefit of doubt.
262+
// POSIX requires posix_fallocate to return EINVAL both for
263+
// invalid arguments (i.e. len < 0) and if the operation is not
264+
// supported by the file system.
265+
// There's no way to tell for sure whether the file system
266+
// supports posix_fallocate, so we must pass the test if it
267+
// returns EINVAL.
276268
}
277269
_ => res.unwrap(),
278270
}
@@ -290,7 +282,7 @@ mod test_posix_fallocate {
290282
| Sys(Errno::EBADF) => (),
291283
errno =>
292284
panic!(
293-
"errno does not match posix_fallocate spec, errno={}",
285+
"unexpected errno {}",
294286
errno,
295287
),
296288
}

0 commit comments

Comments
 (0)