Skip to content

Commit 88a7260

Browse files
committed
Added --umask command line parameter
Signed-off-by: Sergey Yedrikov <syedriko@redhat.com>
1 parent f2a2e7d commit 88a7260

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/fluent/command/fluentd.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@
8181
opts[:chgroup] = s
8282
}
8383

84+
opts[:chumask] = 0
85+
op.on('--umask UMASK', "change umask") {|s|
86+
opts[:chumask] = s
87+
}
88+
8489
op.on('-o', '--log PATH', "log file path") {|s|
8590
opts[:log_path] = s
8691
}

lib/fluent/supervisor.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ def self.load_config(path, params = {})
397397
log_path = params['log_path']
398398
chuser = params['chuser']
399399
chgroup = params['chgroup']
400+
chumask = params['chumask']
400401
log_rotate_age = params['log_rotate_age']
401402
log_rotate_size = params['log_rotate_size']
402403

@@ -436,7 +437,7 @@ def self.load_config(path, params = {})
436437
logger_initializer: logger_initializer,
437438
chuser: chuser,
438439
chgroup: chgroup,
439-
chumask: 0,
440+
chumask: chumask,
440441
suppress_repeated_stacktrace: suppress_repeated_stacktrace,
441442
ignore_repeated_log_interval: ignore_repeated_log_interval,
442443
ignore_same_log_interval: ignore_same_log_interval,
@@ -603,6 +604,7 @@ def initialize(opt)
603604
@plugin_dirs = opt[:plugin_dirs]
604605
@chgroup = opt[:chgroup]
605606
@chuser = opt[:chuser]
607+
@chumask = opt[:chumask]
606608

607609
@log_rotate_age = opt[:log_rotate_age]
608610
@log_rotate_size = opt[:log_rotate_size]
@@ -709,7 +711,7 @@ def run_worker
709711
create_socket_manager if @standalone_worker
710712
if @standalone_worker
711713
ServerEngine::Privilege.change(@chuser, @chgroup)
712-
File.umask(0)
714+
File.umask(@chumask.to_i(8))
713715
end
714716
MessagePackFactory.init(enable_time_support: @system_config.enable_msgpack_time_support)
715717
Fluent::Engine.init(@system_config)

0 commit comments

Comments
 (0)