File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1286,9 +1286,23 @@ def get_e_o_c_d(io) #:nodoc:
1286
1286
io . seek ( -MAX_END_OF_CENTRAL_DIRECTORY_STRUCTURE_SIZE , IO ::SEEK_END )
1287
1287
rescue Errno ::EINVAL
1288
1288
io . seek ( 0 , IO ::SEEK_SET )
1289
+ rescue Errno ::EFBIG # FreeBSD 4.9 raise Errno::EFBIG instead of Errno::EINVAL
1290
+ io . seek ( 0 , IO ::SEEK_SET )
1291
+ end
1292
+
1293
+ # 'buf = io.read' substituted with lump of code to work around FreeBSD 4.5 issue
1294
+ retried = false
1295
+ buf = nil
1296
+ begin
1297
+ buf = io . read
1298
+ rescue Errno ::EFBIG # FreeBSD 4.5 may raise Errno::EFBIG
1299
+ raise if ( retried )
1300
+ retried = true
1301
+
1302
+ io . seek ( 0 , IO ::SEEK_SET )
1303
+ retry
1289
1304
end
1290
1305
1291
- buf = io . read
1292
1306
sigIndex = buf . rindex ( [ END_OF_CENTRAL_DIRECTORY_SIGNATURE ] . pack ( 'V' ) )
1293
1307
raise ZipError , "Zip end of central directory signature not found" unless sigIndex
1294
1308
buf = buf . slice! ( ( sigIndex +4 ) ..( buf . size ) )
You can’t perform that action at this time.
0 commit comments