Browse Source

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.
pull/1/head
Hidden Z 11 years ago
parent
commit
e2c2eeeaae
  1. 1
      bin/py-i2phosts-master

1
bin/py-i2phosts-master

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

Loading…
Cancel
Save