Skip to content

Commit

Permalink
Reset umask in FileArchiver distructor
Browse files Browse the repository at this point in the history
  • Loading branch information
mssalvatore committed May 17, 2020
1 parent 9870971 commit 2c0638f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion owwatcher/file_archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def __init__(self, logger, archive_path, watch_dir, archive_queue, archive_queue
# directory. It also prevents the contents of archive_path from being
# read by an attacker. If, for some reason, archive_path's permissions
# are not strict enough.
os.umask(ARCHIVE_UMASK)
self.orig_umask = os.umask(ARCHIVE_UMASK)

def __del__(self):
os.umask(self.orig_umask)

def run(self):
self.try_read_queue = True
Expand Down
1 change: 1 addition & 0 deletions tests/test_file_archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self):
# Need to put original functionality back so future tests aren't using the
# mocks assigned to shutil and os.path
def __del__(self):
super().__del__()
shutil.copy2 = self.orig_copy2
os.path.realpath = self.orig_realpath

Expand Down

0 comments on commit 2c0638f

Please sign in to comment.