diff options
author | sonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-21 05:07:43 +0000 |
---|---|---|
committer | sonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-21 05:07:43 +0000 |
commit | 7176eb2df98ed89e686c5cc116e9e88ecb238a1c (patch) | |
tree | 5af26662c081b3bb7b76b80f67ab5b75d4207ecd | |
parent | 2c075d38635afc01ca7b7d75fbd11332a122c06f (diff) |
* 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
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | lib/logger.rb | 4 |
2 files changed, 9 insertions, 2 deletions
@@ -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] diff --git a/lib/logger.rb b/lib/logger.rb index f572921db4..4ccc03b614 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -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) |