summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-08-21 21:40:09 -0700
committerelijah <elijah@riseup.net>2013-08-21 21:40:09 -0700
commit62a7adc956c9b8a427788cf1ede3a4f273222228 (patch)
tree5a6645a5f035ac48e0729af79c6480e6a0b0629e /lib
parent41f60e24a90606455eeaa030d7ab2d1e1e637dd6 (diff)
call chown on log file, if appropriate
Diffstat (limited to 'lib')
-rw-r--r--lib/nickserver/daemon.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/nickserver/daemon.rb b/lib/nickserver/daemon.rb
index c316b0a..d03c394 100644
--- a/lib/nickserver/daemon.rb
+++ b/lib/nickserver/daemon.rb
@@ -166,7 +166,10 @@ module Nickserver
if log_path = Config.log_file
FileUtils.mkdir_p File.dirname(log_path), :mode => 0755
FileUtils.touch log_path
- File.chmod(0644, log_path)
+ File.chmod(0600, log_path)
+ if Config.user && Process::Sys.getuid == 0
+ FileUtils.chown(Config.user, nil, log_path)
+ end
$stdout.reopen(log_path, 'a')
$stderr.reopen $stdout
$stdout.sync = true
@@ -207,7 +210,7 @@ module Nickserver
when 'status' then ARGV.shift; @command = :status
when 'version' then ARGV.shift; @command = :version
when 'foreground' then ARGV.shift; @command = :foreground
- when '--verbose' then ARGV.shift; Config.versbose = true
+ when '--verbose' then ARGV.shift; Config.verbose = true
when /^-/ then override_default_config(ARGV.shift, ARGV.shift)
else break
end