diff options
author | Ilya Etingof <etingof@gmail.com> | 2016-05-07 00:47:46 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2016-05-07 00:47:46 +0200 |
commit | e9d05a16fdd949cd2993244ab16a8fa89fdd73b5 (patch) | |
tree | 60042fea0b13511880dc47e88cb692e94db8bf7e | |
parent | b0d77a9ed64361ffc73822ce50766d46e26d1d7c (diff) | |
download | pysnmp-git-e9d05a16fdd949cd2993244ab16a8fa89fdd73b5.tar.gz |
make sure to close/remove temporary files
-rw-r--r-- | pysnmp/entity/engine.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pysnmp/entity/engine.py b/pysnmp/entity/engine.py index 868dbf37..ed91c7a1 100644 --- a/pysnmp/entity/engine.py +++ b/pysnmp/entity/engine.py @@ -135,6 +135,12 @@ class SnmpEngine: os.close(fd) os.rename(fn, f) except Exception: + try: + os.close(fd) + os.unlink(fn) + except Exception: + pass + debug.logger & debug.flagApp and debug.logger( 'SnmpEngine: could not stored SNMP Engine Boots: %s' % sys.exc_info()[1]) else: |