1. George Notaras
  2. tinyids


George Notaras  committed c132981

Modified function that sets filesystem permissions on a path

1. Function renamed from 'chown_chmod_path' to 'set_fs_permissions'
2. chmod occurs before chown

  • Participants
  • Parent commits 9a7d77b
  • Branches default

Comments (0)

Files changed (2)

File src/TinyIDS/main.py

View file
  • Ignore whitespace
         # Set permissions and ownership on the logfile, if running as root
         if user:
-            process.chown_chmod_path(logfile, user, group, 0600)
+            process.set_fs_permissions(logfile, user, group, 0600)
         logger.info('tinyidsd normal startup')
         logger.debug('Logging to file: %s' % logfile)

File src/TinyIDS/process.py

View file
  • Ignore whitespace
         raise UserError('User not found: %s' % user)
-def chown_chmod_path(path, user, group, mode):
+def set_fs_permissions(path, user, group, mode):
     """Sets permissions and ownership on path.
     This can only work only if the process has been started with root
     uid = pwd.getpwnam(user)[2]
     gid = grp.getgrnam(group)[2]
+    os.chmod(path, mode)
     os.chown(path, uid, gid)
-    os.chmod(path, mode)