Commits

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

Comments (0)

Files changed (2)

File src/TinyIDS/main.py

     
         # 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

         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)
+