Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
binwalk
Commits
4b45075e
Commit
4b45075e
authored
Aug 26, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed IOError too many files open bug
parent
e1f8c0d9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
module.py
src/binwalk/core/module.py
+20
-2
No files found.
src/binwalk/core/module.py
View file @
4b45075e
...
@@ -221,6 +221,7 @@ class Module(object):
...
@@ -221,6 +221,7 @@ class Module(object):
self
.
target_file_list
=
[]
self
.
target_file_list
=
[]
self
.
status
=
None
self
.
status
=
None
self
.
enabled
=
False
self
.
enabled
=
False
self
.
previous_next_file_fp
=
None
self
.
current_target_file_name
=
None
self
.
current_target_file_name
=
None
self
.
name
=
self
.
__class__
.
__name__
self
.
name
=
self
.
__class__
.
__name__
self
.
plugins
=
binwalk
.
core
.
plugin
.
Plugins
(
self
)
self
.
plugins
=
binwalk
.
core
.
plugin
.
Plugins
(
self
)
...
@@ -335,12 +336,28 @@ class Module(object):
...
@@ -335,12 +336,28 @@ class Module(object):
'''
'''
fp
=
None
fp
=
None
# Ensure files are close to prevent IOError (too many open files)
try
:
self
.
previous_next_file_fp
.
close
()
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
:
pass
# Add any pending extracted files to the target_files list and reset the extractor's pending file list
# Add any pending extracted files to the target_files list and reset the extractor's pending file list
self
.
target_file_list
+=
[
self
.
config
.
open_file
(
f
)
for
f
in
self
.
extractor
.
pending
]
self
.
target_file_list
+=
self
.
extractor
.
pending
self
.
extractor
.
pending
=
[]
self
.
extractor
.
pending
=
[]
if
self
.
target_file_list
:
if
self
.
target_file_list
:
fp
=
self
.
target_file_list
.
pop
(
0
)
next_target_file
=
self
.
target_file_list
.
pop
(
0
)
# Values in self.target_file_list are either already open files (BlockFile instances), or paths
# to files that need to be opened for scanning.
if
isinstance
(
next_target_file
,
binwalk
.
core
.
common
.
BlockFile
):
fp
=
next_target_file
else
:
fp
=
self
.
config
.
open_file
(
self
.
target_file_list
.
pop
(
0
))
self
.
status
.
clear
()
self
.
status
.
clear
()
self
.
status
.
total
=
fp
.
length
self
.
status
.
total
=
fp
.
length
...
@@ -349,6 +366,7 @@ class Module(object):
...
@@ -349,6 +366,7 @@ class Module(object):
else
:
else
:
self
.
current_target_file_name
=
None
self
.
current_target_file_name
=
None
self
.
previous_next_file_fp
=
fp
return
fp
return
fp
def
clear
(
self
,
results
=
True
,
errors
=
True
):
def
clear
(
self
,
results
=
True
,
errors
=
True
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment