@@ -259,20 +259,12 @@ mod test_posix_fallocate {
259
259
assert_eq ! ( & data as & [ u8 ] , & [ 0u8 ; LEN ] as & [ u8 ] ) ;
260
260
}
261
261
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.
276
268
}
277
269
_ => res. unwrap ( ) ,
278
270
}
@@ -290,7 +282,7 @@ mod test_posix_fallocate {
290
282
| Sys ( Errno :: EBADF ) => ( ) ,
291
283
errno =>
292
284
panic ! (
293
- "errno does not match posix_fallocate spec, errno= {}" ,
285
+ "unexpected errno {}" ,
294
286
errno,
295
287
) ,
296
288
}
0 commit comments