File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
src/tools/miri/src/shims/unix Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1157,10 +1157,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11571157 return this. set_last_error_and_return_i32 ( LibcError ( "EBADF" ) ) ;
11581158 } ;
11591159
1160- // FIXME: Support ftruncate64 for all FDs
1161- let file = fd. downcast :: < FileHandle > ( ) . ok_or_else ( || {
1162- err_unsup_format ! ( "`ftruncate64` is only supported on file-backed file descriptors" )
1163- } ) ?;
1160+ let Some ( file) = fd. downcast :: < FileHandle > ( ) else {
1161+ // The docs say that EINVAL is returned when the FD "does not reference a regular file
1162+ // or a POSIX shared memory object" (and we don't support shmem objects).
1163+ return interp_ok ( this. eval_libc ( "EINVAL" ) ) ;
1164+ } ;
11641165
11651166 if file. writable {
11661167 if let Ok ( length) = length. try_into ( ) {
@@ -1202,10 +1203,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
12021203 let Some ( fd) = this. machine . fds . get ( fd_num) else {
12031204 return interp_ok ( this. eval_libc ( "EBADF" ) ) ;
12041205 } ;
1205- let file = match fd. downcast :: < FileHandle > ( ) {
1206- Some ( file_handle) => file_handle,
1206+ let Some ( file) = fd. downcast :: < FileHandle > ( ) else {
12071207 // Man page specifies to return ENODEV if `fd` is not a regular file.
1208- None => return interp_ok ( this. eval_libc ( "ENODEV" ) ) ,
1208+ return interp_ok ( this. eval_libc ( "ENODEV" ) ) ;
12091209 } ;
12101210
12111211 if !file. writable {
You can’t perform that action at this time.
0 commit comments