diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2008-08-04 01:43:43 +0000 |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2008-08-04 01:43:43 +0000 |
commit | 74e22434597a14eb09510693495808f9ecf4571e (patch) | |
tree | eb4e2f4b946408a8ce4d58b657546a9bf49dced0 /Lib/mailbox.py | |
parent | 18210f9a2efcb8615d6cffb9a1ac097f416f2d87 (diff) | |
download | cpython-74e22434597a14eb09510693495808f9ecf4571e.tar.gz |
Bug 3228: Explicitly supply the file mode to avoid creating executable files,
and add corresponding tests.
Possible 2.5 backport candidate
Diffstat (limited to 'Lib/mailbox.py')
-rwxr-xr-x | Lib/mailbox.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index e3e9cbb342..7651e53b7f 100755 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -398,7 +398,8 @@ class Maildir(Mailbox): result = Maildir(path, factory=self._factory) maildirfolder_path = os.path.join(path, 'maildirfolder') if not os.path.exists(maildirfolder_path): - os.close(os.open(maildirfolder_path, os.O_CREAT | os.O_WRONLY)) + os.close(os.open(maildirfolder_path, os.O_CREAT | os.O_WRONLY, + 0666)) return result def remove_folder(self, folder): @@ -1900,7 +1901,7 @@ def _unlock_file(f): def _create_carefully(path): """Create a file if it doesn't exist and open for reading and writing.""" - fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR) + fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0666) try: return open(path, 'rb+') finally: |