From e28c54abb02311e901ddbb1ace77fc9910a53391 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 11 Nov 2007 12:20:50 +0000 Subject: [PATCH] Use user's umask setting when writing the output. Previously, the output was only readable by the owner. git-svn-id: file:///home/talex/Backups/sf.net/Subversion/zero-install/trunk/0publish@2076 9f8c893c-44ee-0310-b757-c8ca8341c71e --- signing.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/signing.py b/signing.py index 77b4012..24e32e4 100644 --- a/signing.py +++ b/signing.py @@ -32,11 +32,17 @@ def check_signature(path): def write_tmp(path, data): """Create a temporary file in the same directory as 'path' and write data to it.""" tmpdir = os.path.dirname(path) - assert os.path.isdir(tmpdir), "Not a directory: " + tmpdir + if tmpdir: + assert os.path.isdir(tmpdir), "Not a directory: " + tmpdir fd, tmp = tempfile.mkstemp(prefix = 'tmp-', dir = tmpdir) stream = os.fdopen(fd, 'w') stream.write(data) stream.close() + + umask = os.umask(0) + os.umask(umask) + os.chmod(tmp, 0644 & ~umask) + return tmp def run_gpg(default_key, *arguments): -- 2.11.4.GIT