AV-98-fork

A fork of https://tildegit.org/solderpunk/AV-98
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 44ee42ba8a71e78068133ca2248ec234bf73729f
parent 9526c384db8c50c1cc5cea1d66f5a4ac4dee1534
Author: Solderpunk <solderpunk@sdf.org>
Date:   Mon,  8 Jun 2020 21:52:28 +0200

Check that a file exists before trying to delete it.  Rare errors can cause code paths leading to attempted double deletion.

Diffstat:
Mav98.py | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/av98.py b/av98.py @@ -535,7 +535,7 @@ Slow internet connection? Use 'set timeout' to be more patient.""") # Save the result in a temporary file ## Delete old file - if self.tmp_filename: + if self.tmp_filename and os.path.exists(self.tmp_filename): os.unlink(self.tmp_filename) ## Set file mode if mime.startswith("text/"): @@ -1491,9 +1491,9 @@ current gemini browsing session.""" self.db_conn.commit() self.db_conn.close() # Clean up after ourself - if self.tmp_filename: + if self.tmp_filename and os.path.exists(self.tmp_filename): os.unlink(self.tmp_filename) - if self.idx_filename: + if self.idx_filename and os.path.exists(self.idx_filename): os.unlink(self.idx_filename) for cert in self.transient_certs_created: for ext in (".crt", ".key"):