1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-22 12:34:17 +00:00

py-i2phosts-master: chown log_file before daemonization

Master log file first opened as root, than daemonization with privilege
drop happens and master then unable to log to this logfile because of
insufficient permissions. So chown logfile to "runas" user to avoid this
situation.
This commit is contained in:
Hidden Z 2013-10-02 06:33:07 +00:00
parent 3b18825e4d
commit e2c2eeeaae

View File

@ -160,6 +160,7 @@ if not args.debug and not args.verbose:
pw_entry = pwd.getpwnam(runas) pw_entry = pwd.getpwnam(runas)
d.uid = pw_entry[2] d.uid = pw_entry[2]
d.gid = pw_entry[3] d.gid = pw_entry[3]
os.chown(config['log_file'], d.uid, d.gid)
d.open() # become daemon d.open() # become daemon
log = get_logger(filename=log_file, log_level=log_level) log = get_logger(filename=log_file, log_level=log_level)
log.info('started') log.info('started')