pySim-shell: be sure that startup script file exists
When a startup script file is specified that does not exists pySim-shell skips the script and starts normally. This is dangerous because if pySim-shell is called by a shellscript with a nonexisting script file the shellscript may hang forever because there is no script that exists pySim-shell again Change-Id: I4ff2226c8852727aa23357aa54d1e2d480bfaf2d Related: OS#4963
This commit is contained in:
@@ -450,6 +450,12 @@ if __name__ == '__main__':
|
||||
rs.mf.add_file(DF_TELECOM())
|
||||
rs.mf.add_file(DF_GSM())
|
||||
|
||||
# If a script file is specified, be sure that it actually exists
|
||||
if opts.script:
|
||||
if not os.access(opts.script, os.R_OK):
|
||||
print("Invalid script file!")
|
||||
sys.exit(2)
|
||||
|
||||
app = PysimApp(card, rs, opts.script)
|
||||
rs.select('MF', app)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user