aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rw-r--r--lib/logger.rb4
2 files changed, 9 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 92715387cd..1390117375 100644
--- a/NEWS
+++ b/NEWS
@@ -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)