1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/logger.rb (Logger::LogDevice#open_logfile, #create_logfile):

Logger should be able to open only files [Bug #14212]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
sonots 2017-12-21 05:07:43 +00:00
parent 2c075d3863
commit 7176eb2df9
2 changed files with 9 additions and 2 deletions

7
NEWS
View file

@ -416,6 +416,13 @@ with all sufficient information, see the ChangeLog file or Redmine
=== Stdlib compatibility issues (excluding feature bug fixes)
* Logger
* Logger.new("| command") had been working to open a command
unintentionally. It was prohibitted, and now Logger#initialize
treats a String argument only as a filename, as its specification.
[Bug #14212]
* Net::HTTP
* Net::HTTP#start now passes :ENV to p_addr by default. [Bug #13351]

View file

@ -743,7 +743,7 @@ private
def open_logfile(filename)
begin
open(filename, (File::WRONLY | File::APPEND))
File.open(filename, (File::WRONLY | File::APPEND))
rescue Errno::ENOENT
create_logfile(filename)
end
@ -751,7 +751,7 @@ private
def create_logfile(filename)
begin
logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))
logdev = File.open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))
logdev.flock(File::LOCK_EX)
logdev.sync = true
add_log_header(logdev)