diff options
author | lambroslambrou@google.com <lambroslambrou@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 18:04:24 +0000 |
---|---|---|
committer | lambroslambrou@google.com <lambroslambrou@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-10 18:04:24 +0000 |
commit | 7a1aba66b98a13fbe3f06739da42844c2ee8ae00 (patch) | |
tree | c764e42d789d6f8af66ea761cc2ee99959f5ad8f /remoting/tools | |
parent | d41c9c551693509fea8e94232f4444ef5f7eb767 (diff) | |
download | chromium_src-7a1aba66b98a13fbe3f06739da42844c2ee8ae00.zip chromium_src-7a1aba66b98a13fbe3f06739da42844c2ee8ae00.tar.gz chromium_src-7a1aba66b98a13fbe3f06739da42844c2ee8ae00.tar.bz2 |
Fix permissions of log file.
Also fix usage of umask to be consistent for auth and host configs.
BUG=None
TEST=Manual
Review URL: http://codereview.chromium.org/9117004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rwxr-xr-x | remoting/tools/me2me_virtual_host.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py index 2d28a5b..99195b4 100755 --- a/remoting/tools/me2me_virtual_host.py +++ b/remoting/tools/me2me_virtual_host.py @@ -186,10 +186,11 @@ class Host: "host_name": self.host_name, "private_key": self.private_key, } - os.umask(0066) # Set permission mask for created file. + old_umask = os.umask(0066) settings_file = open(self.config_file, 'w') settings_file.write(json.dumps(data, indent=2)) settings_file.close() + os.umask(old_umask) class Desktop: @@ -374,8 +375,11 @@ def daemonize(log_filename): # Create new (temporary) file-descriptors before forking, so any errors get # reported to the main process and set the correct exit-code. + # The mode is provided, since Python otherwise sets a default mode of 0777, + # which would result in the new file having permissions of 0777 & ~umask, + # possibly leaving the executable bits set. devnull_fd = os.open(os.devnull, os.O_RDONLY) - log_fd = os.open(log_filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) + log_fd = os.open(log_filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0600) pid = os.fork() |