File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,13 @@ impl FileDesc {
76
76
-> io:: Result < isize >
77
77
{
78
78
use libc:: pread64;
79
- cvt ( pread64 ( fd, buf, count, offset as i32 ) )
79
+ // pread64 on emscripten actually takes a 32 bit offset
80
+ if let Ok ( o) = offset. try_into ( ) {
81
+ cvt ( pread64 ( fd, buf, count, o) )
82
+ } else {
83
+ Err ( io:: Error :: new ( io:: ErrorKind :: InvalidInput ,
84
+ "cannot pread >2GB" ) )
85
+ }
80
86
}
81
87
82
88
#[ cfg( not( any( target_os = "android" , target_os = "emscripten" ) ) ) ]
@@ -117,7 +123,13 @@ impl FileDesc {
117
123
-> io:: Result < isize >
118
124
{
119
125
use libc:: pwrite64;
120
- cvt ( pwrite64 ( fd, buf, count, offset as i32 ) )
126
+ // pwrite64 on emscripten actually takes a 32 bit offset
127
+ if let Ok ( o) = offset. try_into ( ) {
128
+ cvt ( pwrite64 ( fd, buf, count, o) )
129
+ } else {
130
+ Err ( io:: Error :: new ( io:: ErrorKind :: InvalidInput ,
131
+ "cannot pwrite >2GB" ) )
132
+ }
121
133
}
122
134
123
135
#[ cfg( not( any( target_os = "android" , target_os = "emscripten" ) ) ) ]
You can’t perform that action at this time.
0 commit comments